Saved Bookmarks
| 1. |
Solve : File Properties using batch? |
|
Answer» anyone know how i can use a batch file to look up the size\free space on a drive??Since I have to GUESS your OS, you have to guess if this will work for you: Code: [Select]echo off it works for me (Windows XP) but only if I write for /f "tokens=3" %i in ('dir c: | find /i "free"') do echo %i dir c: | find etc. is good dir c: ^| find etc. isn't what's with the "^|" syntax ? :-?The caret (^) acts as a escape character when using DOS SPECIAL characters. I couldn't find much documentation on why you need it, just that without it under certain conditons the parser will error out. Apparently you need to use it when a DOS special SYMBOL is used in a nested command. In the example I gave you: for /f "tokens=3" %%i in ('dir c: ^| find /i "free"') do echo %%i, the pipe (|) is embedded in the FOR command. I know, I know, not much of a response, but use it if you get an error by not using it. Quote The caret (^) acts as a escape character when using DOS special characters. I guess this shows why an expert is called an expert [smiley=thumbsup.gif] It's exactly as you said. In a batch file, if I LEAVE the ^ out it breaks, if it's in, the parser itself will take care of it, just the opposite at the command line. A bit like doubling % in batch isn't it I never had any idea it should work this way. Thanks a lot for the info [smiley=vrolijk_26.gif] [smiley=beer.gif] |
|