• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Batch file doesn't process when executed, but does when pasted into command window

aburgard

Limp Gawd
Joined
Dec 28, 2005
Messages
357
I'm working with a batch file that doesn't process when executed, but does when pasted into command window:

Code:
SET directory=C:\Uwharrie
SET file=Limits.csv

FOR /F "tokens=1,2,3,4,5,6,7 delims=," %G IN (%directory%\%file%) DO (
IF "%H"=="00118" (ECHO %G,%H,%I,%J,%K,%L,%M >>%directory%\Limits_00118.csv) 
IF "%H"=="00196" (ECHO %G,%H,%I,%J,%K,%L,%M >>%directory%\Limits_00196.csv) 
IF "%H"=="00125" (ECHO %G,%H,%I,%J,%K,%L,%M >>%directory%\Limits_00125.csv))

When executed it spawns a window then closes the window with no output files. When pasted into a command window it creates 3 files as expected.

Any assistance is greatly appreciated!
 
add a pause at the end so that you can see any error messages that may get displayed.
 
You have to escape single percent signs with double percent signs. Any variable that starts (but not ends) with a single % needs to be escaped. In your example, %G needs to be %%G, %H needs to be %%H, etc.
 
Back
Top