Computing.Net > Forums > Disk Operating System > Inputing text string value in Batch file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Inputing text string value in Batch file

Reply to Message Icon

Name: Lankshire
Date: January 13, 2002 at 07:11:51 Pacific
Comment:

Is there any way to input a text value from a batch file prompt? Like "What would you like to name this file?" or "What comment do you want to add to this registry backup?" Thanks.



Sponsored Link
Ads by Google

Response Number 1
Name: Secret_Doom
Date: January 13, 2002 at 11:28:11 Pacific
Reply:

Yes, there is.
You would have to use an input method to ask user for the input, save it to a variable then use that variable. Here follows an example. Let's say the backup file is "backup.dat" and that the comment mark is "::". e.g.:

:: THIS IS A COMMENT

===== Script Start (omit this line) =====

  @echo off
  echo BATCH_INPUT___hgQX-PPP_XPPP E#HH0E50EG0Ef0Ehs>$$input.com
  echo $$input.bat hoAX5@@PZYh@xX5@D3!r/P[WX,b,-PZh>>$$input.com
  echo X3!X2ErP,{,{PYX4=0ErWX,j,-PZh@@X3!=set input>>$$input.com
  echo What comment do you want to add to this registry backup?
  $$input.com
  call $$input.bat
  echo :: %input%>> backup.dat
  for %%d in (bat com) do if exist $$input.%%d del $$input.%%d
  set input=

===== Script end (omit this line) =====

Watch out for line wrapping. All lines that don't begin with two spaces could wrap.

That input method has not check for errors (input may not contain any of these characters: | = ). That's some thing I leave to you to do.

-- Secret_Doom - Leonardo Pignataro --

secret_doom@hotmail.com
www.batch.hpg.com.br


0

Response Number 2
Name: Secret_Doom
Date: January 13, 2002 at 11:30:09 Pacific
Reply:

Sorry, the following information didn't print out ok at my reply:

THE INPUT MAY NOT CONTAIN ANY OF THE FOLLOWING CHARACTERS:
< > | =

-- Secret_Doom - Leonardo Pignataro --

secret_doom@hotmail.com
www.batch.hpg.com.br


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Inputing text string value in Batch file

Variables in batch files www.computing.net/answers/dos/variables-in-batch-files/12289.html

What does the % mean in batch files? www.computing.net/answers/dos/what-does-the-mean-in-batch-files/5925.html

works on string in a batch file www.computing.net/answers/dos/works-on-string-in-a-batch-file/6835.html