Page 1 of 1

trouble with setlocal

Posted: 26 Mar 2010 14:40
by regaw_leinad

Code: Select all

setlocal enabledelayedexpansion
FOR /F "usebackq delims=" %%G IN ("p1ds1.txt") DO (
Set "line=%%G" & echo !line:A          =!
)>>"p1ds2.txt"

FOR /F "usebackq delims=" %%G IN ("p1ds2.txt") DO (
Set "line=%%G" & echo !line:%zip%.zip=!
)>>"p1ds3.txt"
endlocal


this is what I have for a search function to grab the path of the file I input. This is just a small part of my whole script.
My question is that after this (even with endlocal) none of my regular commands work, ie xcopy, java (yes i have java set up on my comp)
they just come up with '(command here)' is not recognized as an internal or external command, program or batch script...
They all work fine in a regular cmd window, but not in my bat after the setlocal/endlocal part.

any reasons why? thanks for your help :)

Re: trouble with setlocal

Posted: 26 Mar 2010 15:11
by aGerman
Imho the endlocal command should not be the problem.

Because of this statement:
regaw_leinad wrote:this is what I have for a search function to grab the path of the file I input.

I speculate that you change the "path" environment variable somewhere and thats why the the commands can't be found.
Have a look to your code and serch for something like
set path=...
and change it to say
set Xpath=...

Regards
aGerman

Re: trouble with setlocal

Posted: 26 Mar 2010 15:19
by regaw_leinad
wow, I can't believe I missed that. Thank you so much for helping me :)