1.

Solve : Prompt for user input of file?

Answer»

I need to execute specific files based on a Change Request. The files names change with every change request. The directories where the files reside changes from time to time as well, depending on the version being DEPLOYED. There are usually many files residing in each version directory. Currently I COPY the FILE to a separate "staging" directory, but I was WONDERING what I would need to add to my batch file to prompt the user to insert the directory name\file name in the command window so it can execute that specific file without having to copy the target file to a separate directory?Try this
Set /P MyDirectory=Enter Directory:

This will wait for the user to enter a directory name, this will be held in %MyDirectory%

GrahamYou can use set /p to get user input into a variable

Code: [Select]set /p path.and.name="Please type file path and name: "
echo The user typed %path.and.name%
Don't forget to use it as "%path.and.name%" for file OPERATIONS if there is any possibility of it containing spaces.
That did the trick! Thank you both very much!



Discussion

No Comment Found