|
Answer» How does one escape the '\' in a path. I wish to use the \ as a delimiter in the for command but it won't accept the \ in its location.
The code is Code: [Select]for /f "eol=; tokens=4 delim=\" %i in moveTIFF .dat do @echo %i and the error message is Code: [Select]delim=\" was unexpected at this timeThe moveTIFF.dat format is Code: [Select]\TestingTiffMoves\AU\PICKLIST\0000544B.TIF \TestingTiffMoves\AU\PICKLIST\0000544C.TIF \TestingTiffMoves\AU\PICKLIST\0000544D.TIF \TestingTiffMoves\AU\PICKLIST\0000544E.TIF \TestingTiffMoves\AU\PICKLIST\index.dat
What I want to do is extract initially the *.TIFF and index.dat to echo them. Once I have done that I will replace the @echo will the copy command.. (I had originally done a lot of work like this but whem we migrated from XP to Vista somehow or my batch files and notes got lost )Code: [Select] for /f "eol=; tokens=4 delims=\" %i in (moveTIFF.dat) do @echo %i
it's delims, not delim ALSO you need brackets around the filename.
You don't need to escape a backslash. You just need to use delims with an 's'.
Code: [Select]"delims=\" However the more usual way to get at the various parts of a file data (full path, drive letter, path, FOLDER, file name, file extension, size, date etc) is to use the FOR variable modifiers. These can be viewed at the prompt by typing FOR /?
Quote from: BC_Programmer on October 21, 2009, 12:56:45 AM
it's delims, not delim also you need brackets around the filename.
*censored* fat fingers. Thank youQuote from: Salmon Trout on October 21, 2009, 01:04:43 AMYou don't need to escape a backslash. You just need to use delims with an 's'.
Code: [Select]"delims=\" However the more usual way to get at the various parts of a file data (full path, drive letter, path, folder, file name, file extension, size, date etc) is to use the FOR variable modifiers. These can be viewed at the prompt by typing FOR /?
I will try those variable modifiers. Thank you.
|