Home / Microsoft / Microsoft DOS / Command Prompt (CMD); Two issues about DIR command
0 Members and 3 Guests are viewing this topic. « previous next »
Pages: 1 [2]  All - (Bottom) Print
Author Topic: Command Prompt (CMD); Two issues about DIR command  (Read 1487 times)
Salmon Trout
Sage



Thanked: 546
Posts: 7,952

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #15 on: November 27, 2009, 12:27:42 AM »

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-it3
IP logged


Proud to be European
AT005
Topic Starter
Rookie



Posts: 13


« Reply #16 on: November 28, 2009, 09:26:14 AM »

hello?
IP logged
AT005
Topic Starter
Rookie



Posts: 13


« Reply #17 on: November 29, 2009, 04:35:43 AM »

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.  :(
IP logged
Salmon Trout
Sage



Thanked: 546
Posts: 7,952

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #18 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.

IP logged


Proud to be European
AT005
Topic Starter
Rookie



Posts: 13


« Reply #19 on: November 29, 2009, 08:44:38 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.
IP logged
Salmon Trout
Sage



Thanked: 546
Posts: 7,952

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #20 on: November 29, 2009, 08:47:31 AM »

You left the > filename.doc off the end.
IP logged


Proud to be European
AT005
Topic Starter
Rookie



Posts: 13


« Reply #21 on: November 29, 2009, 08:52:06 AM »

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  ???
IP logged
Salmon Trout
Sage



Thanked: 546
Posts: 7,952

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #22 on: November 29, 2009, 08:54:41 AM »

I think you are going to have to learn some batch scripting
IP logged


Proud to be European
AT005
Topic Starter
Rookie



Posts: 13


« Reply #23 on: December 04, 2009, 01:30:47 PM »

Why nobody wants to tell me what should I do, in my situation, described in first and third post?  :(
IP logged
Pages: 1 [2]  All - (Top) Print 
Home / Microsoft / Microsoft DOS / Command Prompt (CMD); Two issues about DIR command « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.115 seconds with 19 queries.