Batch file help

  • Thread starter Thread starter Tome
  • Start date Start date
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
 
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
 
Back
Top