0

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?

aschipfl
  • 33,626
  • 12
  • 54
  • 99
  • Rename the file to batch and run it. Open in notepad and search for `/` and replace with ` \ ` as that is the windows standard. –  Sep 27 '16 at 11:45
  • Thanks, this did actually work, the only problem is, that these programs are console-applications, therefore only 1 is ran because it takes the bat window – Pokeemerald Sep 27 '16 at 11:47
  • Does output.txt really contain a single line containing paths separated by ? – Compo Sep 27 '16 at 11:48
  • No it doesn't its just a list of the paths. I can't get it into stackoverflow: http://hastebin.com/heqiwemuci.tex – Pokeemerald Sep 27 '16 at 11:49
  • …and what does your start script look like, _(you must have one because you've just reported it working only for one file)_. – Compo Sep 27 '16 at 11:51
  • C:\MusicBots\Bot2\sinusbot.exe [NEW LINE] C:\MusicBots\Bot3\sinusbot.exe [NEW LINE] C:\MusicBots\TESTBOT_KRXTZ\sinusbot.exe – Pokeemerald Sep 27 '16 at 11:52
  • I thought that was your output.txt, I'm lookng for your batch script content – Compo Sep 27 '16 at 11:55
  • Noodles sugested to just rename my output.txt to output.bat , changing the / to \ – Pokeemerald Sep 27 '16 at 11:56

1 Answers1

1
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).

Community
  • 1
  • 1