Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Batch File. 2

Status
Not open for further replies.

Ed2020

Programmer
Nov 12, 2001
1,899
GB
Hi,

I am using the following DOS command to loop through all directories within my current directory and retrieve the Size and Size on Disk properties:

Code:
FOR /D %G in ("*") DO "c:\Eds Stuff\Get Directory Sizes\du.exe" -l 0 "%G" >>"c:\Eds Stuff\Get Directory Sizes\dir_details.txt"

This works perfectly when run from a command prompt but when I put it in a batch file it no longer works. The command prompt window flashes up briefly, then disappears.

Can anyone shed any light on this please?

Thanks,

Ed.

Please do not feed the trolls.....
 
Hi Ed

In a batch file, %G must be coded %%G.

See DO /? for details.

Jock
 
Oops - prev post should have read "see FOR /? for details".
Need more coffee ...

Jock
 
or rather than a .bat, make is a .cmd then is will run in as a command

ACSS - SME
General Geek



1832163.png
 
Great, thanks guys. Will try this tomorrow.

Please do not feed the trolls.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top