Link to home
Start Free TrialLog in
Avatar of WorknHardr
WorknHardr

asked on

DOS For Do Goto Replaces Call?

Cool title huh. Anyway, I've been using two DOS batch files and would like to consolidate them into one batch file. Unsure how to do the 'Call'.

( Batch File #1 )
For %%i In (\bin\*.dll) Do (Call BatchFile2.bat "%%~i")

( Batch File #2 )
set "ESP=C:\Program Files\eSoft\Protector"
set "SAFE=%1"
"%ESP%"\Protector.exe
-source %1
-target %SAFE%

( Possible One Batch File Solution Not Working )
For %%i In (\bin\*.dll) Do (Goto NEXT "%%~i")
:NEXT
set "ESP=C:\Program Files\eSoft\Protector"
set "SAFE=%1"
"%ESP%"\Protector.exe
-source %1
-target %SAFE%
Avatar of Bill Prew
Bill Prew

This should work, just put the logic you need inside the FOR loop as shown.

@echo off
set "ESP=C:\Program Files\eSoft\Protector"
For %%i In (\bin\*.dll) Do (
  "%ESP%"\Protector.exe -source %%~i -target %%~i
)

Open in new window

~bp
Avatar of WorknHardr

ASKER

yea, more logical. I need the target file path different from the source. I've been using this substitution syntax, not working now:

set "ESP=C:\Program Files\eSoft\Protector"
set "SAFE=%1"
Set "SAFE=%SAFE:Published=Release%"

"%ESP%"\Protector.exe
-source %1
-target %SAFE%
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thx