rkillcrazy Posted March 26, 2008 Share Posted March 26, 2008 I have several machines that have had people playing around with the ATTRIBcommand. Now, I have some files that are no longer hidden like they shouldbe. 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 searchrecursively through the current folder and its child directories and run acommand if the file is found....FOR /F %%I IN ("DESKTOP.INI") DO IF EXIST %%~nI ATTRIB +S +H DESKTOP.INI /SRunning that command outputs an error:%%I was unexpected at this time. Link to comment Share on other sites More sharing options...
IcemanND Posted March 26, 2008 Share Posted March 26, 2008 If you want to process all DESKTOP.INI files in the current tree all you need to run is the attrib command from the desired folder.ATTRIB +s +H DESKTOP.INI /SThe /S does the recursive searching for you. If you want to check the current folder before you run it use:If EXIST DESKTOP.INI ATTRIB +S +H DESKTOP.INI /S Link to comment Share on other sites More sharing options...
rkillcrazy Posted March 26, 2008 Author Share Posted March 26, 2008 If you want to process all DESKTOP.INI files in the current tree all you need to run is the attrib command from the desired folder.ATTRIB +s +H DESKTOP.INI /SThe /S does the recursive searching for you. If you want to check the current folder before you run it use:If EXIST DESKTOP.INI ATTRIB +S +H DESKTOP.INI /SOk, I'll try that... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now