Loop through files using Do start/wait command

January 12, 2016 at 18:26:05
Specs: Windows 7, Core2duo 2ghz / 4G
I'm having a problem getting a batch file to work.

I have a file in a folder, named sjsetup_x86-700.exe. Because the name of the file changes with new versions, I want to use a For loop to find the current file and execute it. So I've tried permutations of:

For %%G in (sjsetup*) Do start /wait "" %%G /S

I've tried it with various permutations of the quote marks. I've tried separating the start command into a multiline format, but nothing is working.

Any guidance? Thanks.

message edited by paul1149

See More: Loop through files using Do start/wait command

Report •

January 12, 2016 at 19:22:06
I see little point in STARTing or WAITing.

::====== script starts here ===============
:: paul.bat 2016-01-13 10:16:44.22
@echo off & setLocal enableDELAYedeXpansioN

for /f "tokens=* delims= " %%a in ('dir/b/od *.exe') do (
set prog=%%a
::====== script ends here =================


M2 Get custom script or take private lessons

Report •

January 12, 2016 at 20:13:52
Obvious question, but is the script in the same directory as this sjsetup* file?

How To Ask Questions The Smart Way

Report •

January 12, 2016 at 20:17:16
Razor - yes. The batch works without the For / Do command and wildcard.

Mechanix - let me try to apply that to what I'm trying to do here.


Report •

Related Solutions

January 14, 2016 at 19:31:25
Ok, I found my problem. The file is not sjsetup...., it is sjtsetup..... There's a "t" in there my eyes did not see. With that correction, both Mechanix' and my old batch are working. Thanks for the input and sorry for the error.

message edited by paul1149

Report •

Ask Question