MSFN Forum: Batch file help - MSFN Forum

Jump to content



Unattended CD/DVD Guide Homepage · MSFN Forum Rules

If you have questions about customizing Windows XP that are nLite-specific, please post them in the nLite forum, not here. If you have questions regarding the unattended installation of Windows XP, please post them in the Unattended Windows 2000/XP/2003 section.
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Batch file help Having trouble figuring out why this won't work. Rate Topic: -----

#1 User is offline   rkillcrazy 

  • Newbie
  • Group: Members
  • Posts: 25
  • Joined: 23-November 03

  Posted 26 March 2008 - 05:23 AM

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.



#2 User is offline   IcemanND 

  • MSFN Junkie
  • Group: Super Moderator
  • Posts: 3,249
  • Joined: 24-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 26 March 2008 - 06:36 AM

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

#3 User is offline   rkillcrazy 

  • Newbie
  • Group: Members
  • Posts: 25
  • Joined: 23-November 03

Posted 26 March 2008 - 06:57 AM

View PostIcemanND, on Mar 26 2008, 07:36 AM, said:

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

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy