Jump to content

Recommended Posts

Posted

@ECHO OFF
REM Legend / Variables
REM --------------------------------
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 Drive
REM --------------------------------
:START
GOTO DANDS

REM Documents And Settings
REM --------------------------------

:DANDS
attrib +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 PROG

REM Program Files
REM --------------------------------

:PROG
GOTO WIN


REM Windows
REM --------------------------------

:WIN
attrib +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

:END
exit

What is wrong with this batch file? It changes attributes fine but seems to not want to exit at all...


Posted (edited)

where is ur

:start variable

this is stupid command

no need to make hidden and system for those which is already hidden and system

Edited by Nepali
Posted (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 by Nmcsween
Posted

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 varibles

Green Text is the array for the files

Const READ_ONLY = 1,Hidden = 2

Dim Act, All_UP, Change, Fso, SD, SR, SR_Sys32, User_P

Set 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

Posted

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.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

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