|
Answer» ok i have a variable the the user will input with a line after it like so %input%__________________________________ but the problem is that i have now way to know how long the user input will be so if they put in somthig realy long i want it to make the line only go a little bit so the line will not word wrap if they input bla bla bla bla bla bla bla it will look like so bla bla bla bla bla bla bla bla bla bla:__________________________ or like this somthing short:_______________________________________ ____ any IDEAS :-? :-? please helpso can you clarify your question ? what ahould the input ? Some information ?
AlmnNot sure what purpose the line has. Why not use just a simple prompt like:
set /p var=Enter input here:
If a long string of data is entered at the prompt, you can ALWAYS resize it with:
%var:~x,y%
where x and y are INTEGERS representing offset and length of the promptstring you want to process.
Keep in mind, batch language is designed as a command language. There are many scripting languages you can use that can do most programming tasks.
8-)im making a file wher the user can put in a question and it ads linse fore people to right on once printedThis will never be classified as elegant but hey, every once in a while you gotta get dirty.
Code: [Select]@echo off set /p var=Enter input here: set outline=%var%___________________________________________________________ set fileline=%outline:~0,35% echo %fileline% > outfile.txt
The whole theory here is to get the prompt data, APPEND this magical line of yours, and then standardize the length of each line at 35 bytes before dumping it into a file.
The 0,35 can be changed as required. I chose 35 arbitrarily.
This would be so much easier in any of the Windows scripting languages, but for some reason a lot of PC users won't let go of batch coding. [sigh] 8-)
|