Nmcsween Posted September 3, 2005 Posted September 3, 2005 @ECHO OFFREM Legend / VariablesREM --------------------------------REM + Sets an attribute.REM - Clears an attribute.REM R Read-only file attribute.REM A Archive file attribute.REM S System file attribute.REM H Hidden file attribute.REM /S Processes matching files in the current folder and all subfolders.REM /D Processes folders as well.REM System DriveREM --------------------------------:STARTGOTO DANDSREM Documents And SettingsREM --------------------------------:DANDSattrib +H +S "%ALLUSERSPROFILE%\ntuser.dat"attrib +H +S "%ALLUSERSPROFILE%\ntuser.log"attrib +H +S +R "%SystemDrive%\Documents And Settings\Default User\Cookies\index.dat"attrib +H +S "%USERPROFILE%\ntuser.dat"attrib +H +S "%USERPROFILE%\ntuser.log"GOTO PROGREM Program FilesREM --------------------------------:PROGGOTO WINREM WindowsREM --------------------------------:WINattrib +H +S "%SystemRoot%\system32\config\AppEvent.Evt"attrib +H +S "%SystemRoot%\system32\config\default"attrib +H +S "%SystemRoot%\system32\config\default.LOG"attrib +H +S "%SystemRoot%\system32\config\SAM"attrib +H +S "%SystemRoot%\system32\config\SAM.LOG"attrib +H +S "%SystemRoot%\system32\config\SecEvent.Evt"attrib +H +S "%SystemRoot%\system32\config\SECURITY"attrib +H +S "%SystemRoot%\system32\config\SECURITY.LOG"attrib +H +S "%SystemRoot%\system32\config\software"attrib +H +S "%SystemRoot%\system32\config\software.LOG"attrib +H +S "%SystemRoot%\system32\config\SysEvent.Evt"attrib +H +S "%SystemRoot%\system32\config\System"attrib +H +S "%SystemRoot%\system32\config\System.LOG"attrib +H +S "%SystemRoot%\WindowsUpdate.log"attrib +H +S "%SystemRoot%\Debug\PASSWD.LOG"attrib +H +S "%SystemRoot%\SoftwareDistribution\ReportingEvents.log" attrib +H +S "%SystemRoot%\SchedLgU.Txt"GOTO END:ENDexitWhat is wrong with this batch file? It changes attributes fine but seems to not want to exit at all...
Nepali Posted September 3, 2005 Posted September 3, 2005 (edited) where is ur :start variablethis is stupid commandno need to make hidden and system for those which is already hidden and system Edited September 3, 2005 by Nepali
Nmcsween Posted September 3, 2005 Author Posted September 3, 2005 (edited) Rephrase stupid with good and rephrase which is with which isn't. Some files are already hidden I just like to make sure nothing changed the attributes by enforcing it. Edited September 3, 2005 by Nmcsween
Doc Symbiosis Posted September 3, 2005 Posted September 3, 2005 Runs fine including exitting on my XP SP2 regardless of starting from commandline or explorer.Perhaps try to insert some pause commands to get the place, where the script hangs.
gunsmokingman Posted September 3, 2005 Posted September 3, 2005 Here try this VBS Script and see if it works I tested it on my computer and got not errors.Blue Text is the locations as variblesGreen Text is the array for the files Const READ_ONLY = 1,Hidden = 2Dim Act, All_UP, Change, Fso, SD, SR, SR_Sys32, User_PSet Act = CreateObject("Wscript.shell")Set Fso = CreateObject("Scripting.FileSystemObject")SR = Act.ExpandEnvironmentStrings("%SystemRoot%")SD = Act.ExpandEnvironmentStrings("%SystemDrive%")All_UP = Act.ExpandEnvironmentStrings("%ALLUSERSPROFILE%")User_P = Act.ExpandEnvironmentStrings("%USERPROFILE%") SR_Sys32 = SR & "\system32\config" '''' Array That Stores All The Locations Change = Array (All_UP & "\ntuser.dat",All_UP & "\ntuser.log",_ SD & "\Documents And Settings\Default User\Cookies\index.dat",_ User_P & "\ntuser.dat",User_P & "\ntuser.log",SR_Sys32 & "\AppEvent.Evt",SR_Sys32 & "\default",_ SR_Sys32 & "\default.LOG",SR_Sys32 & "\SAM",SR_Sys32 & "\SAM.LOG",SR_Sys32 & "\SecEvent.Evt",_ SR_Sys32 & "\SECURITY",SR_Sys32 & "\SECURITY.LOG",SR_Sys32 & "\software",SR_Sys32 & "\software.LOG",_ SR_Sys32 & "\SysEvent.Evt",SR_Sys32 & "\System",SR_Sys32 & "\System.LOG",SR & "\WindowsUpdate.log",_ SR & "\Debug\PASSWD.LOG",SR & "\SoftwareDistribution\ReportingEvents.log") '''' Goes Threw The Change Array And See If Set To Read Only Or Hidden For Each StrChange In Change On Error Resume Next Set objReadOnlyFile = Fso.GetFile(StrChange) objReadOnlyFile.Attributes = objReadOnlyFile.Attributes XOR READ_ONLY Next For Each StrChange In Change On Error Resume Next Set objHiddenFile = Fso.GetFile(StrChange) objHiddenFile.Attributes = objHiddenFile.Attributes XOR Hidden Next Act.Popup "Completed The Script", 3, "Attrib Resets", 0 + 32
sleepnmojo Posted September 3, 2005 Posted September 3, 2005 I would assume it is getting hung up on a file. Change the REM commands to ECHO commands, to see where it seems to stop. Then you can narrow it down further by throwing more ECHO commands.
Martin Zugec Posted September 3, 2005 Posted September 3, 2005 First step in any batch debugging - disable @Echo off and redirect output to text file, so you can see what is going on...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now