I'm working on a start script, and I have a text file output.txt
, containing paths to programs, like:
C:/program1.exe C:/abab/program2.exe
How do I now run the programs contained in the text file via a batch script?
I'm working on a start script, and I have a text file output.txt
, containing paths to programs, like:
C:/program1.exe C:/abab/program2.exe
How do I now run the programs contained in the text file via a batch script?
for /f "usebackq delims=" %A in ("C:\output.txt") Do Start "" "%A"
Start
starts programs without waiting for them to exit (so new window) and first set of quotes is the window title. UseBackq
is needed to use quotes around output.txt. See For /?
and my answer here for how to start programs Trouble with renaming folders and sub folders using Batch. In a batch use %%A
and %A
when typing interactively (I don't use batch files, I keep stuff in one text file and paste parts into a command prompt window,which is interactive).
If they were to be run sequentially then
Rename the file to batch and run it. Open in notepad and search for / and replace with
\
as that is the windows standard (although autocorrect will fix it without telling you but can sometimes cause problems).