Jump to content

Recommended Posts

Posted

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....

FOR /F %%I IN ("DESKTOP.INI") DO IF EXIST %%~nI ATTRIB +S +H DESKTOP.INI /S

Running that command outputs an error:

%%I was unexpected at this time.


Posted

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 /S

The /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

Posted
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 /S

The /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

Ok, I'll try that...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...