How to skip the input in batch file?

I have a batch file problem, can you please help me? If you do i will pick as best answer!?

  • Ok, so i am not very fluint with batch file creating. I am in need two codes. One to save the user inputs of the batch file such as "set /p name=you're name:". And then save it as a file such as a text file. Then i need another code for when i open up the batch file agein (or open up a diffrant one) it can pull out "%name%" from that one file, and show you it. I need it to not just display it i need it to set it as %name% so if i type "echo you're name is %name%" then it will work by getting name from the file not the user input. If you can help me then please do.

  • Answer:

    This is the script to prompt for the User Name and save it to a file: ------- @echo off REM REM Get the user name and then save it to a text file. REM REM Get the User Name. set /p UserName="Enter User Name: " REM Save the User Name to a file named UserName.txt echo %UserName% >UserName.txt REM ---End of Script--- @echo on ------- This is the script to read the User Name from a file, and set it to a variable inside the batch file: ------- @echo off REM REM Get the user name from a text file, and assign it to a variable. REM REM Read the User Name from the text file and set it to %%i. for /f "delims=#" %%i in (UserName.txt) do ( echo %%i ) REM ---End of Script--- @echo on -------

inmysite... at Yahoo! Answers Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.