Problem with DOS Batch File

Microsoft Windows xp professional editio...
October 29, 2009 at 10:52:50
Specs: Windows XP
Can anyone please get the following lines to work correctly for me (ie no error)? Thank you.

for /F %%x in (' "c:\program files\abcdir\scripts\getline.bat" c:\program file\abcdir\data\params.txt 4 ' ) do set var=%%x
echo Var is: %var%

getline.bat justs prints a given line number from a file. The problem is that the 2nd c:\program files is read as just c:\program (ie the space character causes an issue). Thanks again

See More: Problem with DOS Batch File

Report •

October 29, 2009 at 12:10:36
Can't do it without getline.bat but I think your problem is missing quotes. Try...

for /F %%x in (' "c:\program files\abcdir\scripts\getline.bat" "c:\program file\abcdir\data\params.txt" 4' ) do set var=%%x

Not sure what the 4 is all about but not seeing the code for getline.bat I can't tell.

Report •

October 29, 2009 at 12:56:41
Hi. Thank you for the response. Suprisingly, by adding the second set of quotes, the first string of "/program files" is misinterpreted as just /program, rather than the second string being misinterpreted. Doesn't make a lot of sense. The 4 is the line number that getline gets, but getline doesn't even get called because I get an error to the effect of "No such file /program" Let me know if you have any other ideas though. Thanks again!!

Report •

October 29, 2009 at 13:10:20
What shell are you running this on? CMD or Command? You can not use long file names in Command. Also, how do you know where it is blowing up? Try putting an ECHO GOT TO THE GETLINE.BAT in side the getline.bat because it could be blowing up on the %1.

Report •

Related Solutions

October 29, 2009 at 13:26:26
Yes, that's exactly what I did to find out where it is blowing up. I also change the spelling of the first \program file to \progrEm files to see the error message change. Thank you again!!

Report •

Ask Question