Batch file help

T

Tome

I have several machines that have had people playing around with the ATTRIB
command. Now, I have some files that are no longer hidden like they should
be. I have a batch file that seems like it should work but in fact does not.
Any guidance would be great! Below is an example. I just want to search
recursively through the current folder and its child directories and run a
command if the file is found....

This is one line of code....
FOR /F %%I IN ("DESKTOP.INI") DO IF EXIST %%~nI ATTRIB +S +H DESKTOP.INI /S
 
P

Pegasus \(MVP\)

Tome said:
I have several machines that have had people playing around with the ATTRIB
command. Now, I have some files that are no longer hidden like they
should
be. I have a batch file that seems like it should work but in fact does
not.
Any guidance would be great! Below is an example. I just want to search
recursively through the current folder and its child directories and run a
command if the file is found....

This is one line of code....
FOR /F %%I IN ("DESKTOP.INI") DO IF EXIST %%~nI ATTRIB +S +H DESKTOP.INI
/S

This seems overly complicated way of doing a simple job.
I recommend this line:
attrib desktop.ini +s +h /s
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top