Saved Bookmarks
| 1. |
Solve : Command Prompt (CMD); Two issues about DIR command? |
|
Answer» Quote from: BatchFileBasics on November 26, 2009, 04:16:24 PM thats the problem, you can't use for loops in the command prompt without a script. That is not so; at the prompt you just use one % sign in the loop variables (instead of two) Code: [Select] S:\Test>for /f "tokens=1,2,3,4,5 delims=\" %a in ('dir /ad /s /b') do echo %a\%b\%c\%d\%e S:\Test\Batch\Older\custom-path S:\Test\Other\Auto-it\ S:\Test\Other\Basic\ S:\Test\Other\beep\ S:\Test\Other\cURL\ S:\Test\Other\FTP\ S:\Test\Other\FUS-Repair\ S:\Test\Other\getmail\ S:\Test\Other\ghacker\ S:\Test\Other\hta\ S:\Test\Other\kix\ S:\Test\Other\Mirakagi\ S:\Test\Other\NATW\ S:\Test\Other\PopClient\ S:\Test\Other\Portable-Ubuntu\ S:\Test\Other\Python\ S:\Test\Other\reg\ S:\Test\Other\Ruby\ S:\Test\Other\textview\ S:\Test\Other\UnxUtils\ S:\Test\Other\virtual disk\ S:\Test\Other\wget_GUI\ S:\Test\Other\winmsg\ S:\Test\Other\winWget\ S:\Test\Other\wmv-avi\ S:\Test\Other\Zerodir\ S:\Test\Other\Auto-it\Auto-it3 S:\Test\Other\Auto-it\Checkbox S:\Test\Other\Auto-it\MsgBox S:\Test\Other\Auto-it\Auto-it3 S:\Test\Other\Auto-it\Auto-it3hello?I tried with: Code: [Select]echo off for /f "tokens=4,5 delims=\" %%a in ('dir /ad /s /b') do echo %%a\%%b instead of Code: [Select]echo off for /f "tokens=4,5 delims=\" %%a in ('dir /ad /s /b') do echo %%a\%%b pause But EVEN this doesn't do anything. You are doing something wrong. We do not know what, since you don't give enough INFORMATION. Quote from: Salmon Trout on November 29, 2009, 05:50:07 AM You are doing something wrong. We do not know what, since you don't give enough information. I have tried to use the both codes - of COURSE NOT at the same time. I have pasted them to notepad, each time i saved them as .bat. Firstly used second code but since it doesn't work, I used first one but doesn't work too - two .doc files are still not created. What I wish to have in .doc files is DESCRIBED in my first and second post.You LEFT the > filename.doc off the end. If you meant this: Code: [Select]echo off for /f "tokens=4,5 delims=\" %%a in ('dir /ad /s /b') do echo %%a\%%b > filename.doc pause It does give me the .doc file but just one instead of two and with terrible results inside - completely different from what I was asking I think you are going to have to learn some batch scriptingWhy nobody wants to tell me what should I do, in my situation, described in first and third post? |
|