Edited: Parsing a path with FOR command in DOS


[ Follow Ups ] [ Post Followup ] [ The EasyDOS Forum ] [ FAQ ]

Posted by drumsticks on May 02, 2008 at 12:47:10:

In Reply to: Parsing a path with FOR command in DOS posted by drumsticks on May 02, 2008 at 12:44:35:

: It looks like if I have this command within an IF statement, then it will not working properly.

: I had an IF statement wrapped around the FOR command like so:

: SET path=c:\webserver\second\third
: IF EXIST %path% (
: REM do some command
: ) ELSE (
: FOR /F "usebackq tokens=1,2,3,4 delims=\" %%G IN (%path%) DO (SET drive=%%G&SET webserver=%%H&SET secondDir=%%I&SET thirdDir=%%J)
: REM drive: %drive%
: REM webserver: %webserver%
: REM secondDir: %secondDir%
: REM thirdDir: %thirdDir%
: )

: So, it seems like this IF statement is restricting the variables from getting instantiated with the parsed path data. Is there something wrong with this, or is this some sort of bug maybe?

: Thanks for any input!




Follow Ups:



Post a Followup (use TAB key to move between boxes - NOT ENTER or RETURN)

Name:
E-Mail:

Subject:

Type your comments in the box below and SUBMIT:


[ Follow Ups ] [ Post Followup ] [ The EasyDOS Forum ] [ FAQ ]