Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Batch File Wont Exit?

Featured Replies

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

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

  • Author

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

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.

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

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.

First step in any batch debugging -

disable @Echo off and redirect output to text file, so you can see what is going on...

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.