Link to home
Start Free TrialLog in
Avatar of zhshqzyc
zhshqzyc

asked on

a dos batch command

Can you explain the code?
for /f %%c in ('"dir /b:d"') do %GZIP% %%c\*.txt

Open in new window


Thank you.
Avatar of Marcellino Santoso
Marcellino Santoso
Flag of Netherlands image

for /f %%c in ('"dir /b:d"') do %GZIP% %%c\*.txt

Open in new window


do archive every files that has the extension .txt for every given file listed from the command dir /b according to the variable %%c.

gzip is a program / operation to archive file. the %GZIP% is a parameter / routine / process defined elsewhere.

I don't know what's parameter /b:d in the dir command, as far as I know there is no such parameter. /b will output bare formatting of the files in the respective directory, but :d (colon d) is unknown.

%%c is a self defined parameter, it can be anything.
Avatar of zhshqzyc
zhshqzyc

ASKER

Sorry, typo.
for /f %%c in ('"dir /b /a:d"') do %GZIP% %%c\*.txt

Open in new window

/b is bare
/a:d is attributes only show directories
ASKER CERTIFIED SOLUTION
Avatar of Marcellino Santoso
Marcellino Santoso
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Men has the answer :-)