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.

SetupComplete.cmd and files not deleted

Featured Replies

HI

I wrote this RemovePending.vbs script used to delete multiple files at the end of a custom installation of Vista SP2 and, then, I inserted, in the SetupComplete.cmd file, the calls to this vbs script. Namely:

Option Explicit
Dim objFSO, objReg, objArgs
Dim objFile, objFolder, objSubFolder
Dim arrObjects, arrOldObjects, strKill

Const HKEY_LOCAL_MACHINE = &H80000002

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objArgs = Wscript.Arguments
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\root\default:StdRegProv")

objReg.GetMultiStringValue HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Session Manager", "PendingFileRenameOperations", ArrOldObjects
If isArray(arrOldObjects) Then strKill = Join(arrOldObjects, vbTab)

If objArgs.Count = 0 Then
Wscript.Echo "Script for scheduling files and folders for removal at next boot" & vbCrLf &_
"Syntax: RemovePending.vbs c:\folder"
Wscript.Quit
End If


If objFSO.FolderExists(objArgs(0)) Then
DeleteFolder objArgs(0)
ElseIf objFSO.FileExists(objArgs(0)) Then
KillObject(objArgs(0))
Else
Wscript.Echo "Can't find path: " & objArgs(0)
Wscript.Quit
End If


arrObjects = Split(strKill, vbTab)
objReg.SetMultiStringValue HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Session Manager", "PendingFileRenameOperations", ArrObjects
If Err.number = 0 Then
Wscript.Echo objArgs(0) & " was scheduled for removal at next boot."
Else
Wscript.Echo "Could not schedule object for removal" & vbCrLf & "Error: " & Err.Number & " " & Err.Description
End If

Private Sub DeleteFolder(strFolder)
Set objFolder = objFSO.GetFolder(strFolder)
For Each objSubFolder In objFolder.SubFolders
DeleteFolder(objSubFolder.Path)
Next
For Each objFile In objFolder.Files
objFSO.GetFile(objFile).Attributes = 0
KillObject objFile.Path
Next
objFSO.GetFolder(strFolder).Attributes = 0
KillObject strFolder
End Sub


Sub KillObject(strObject)
If Len(strKill) > 0 Then strKill = strKill & vbTab
strKill = strKill & "\??\" & strObject
strKill = strKill & vbTab
End Sub

and, at the end of the SetupComplete.cmd file, I wrote:

cscript %windir%\Setup\Scripts\RemovePending.vbs %windir%\Setup\Scripts
cscript %windir%\Setup\Scripts\RemovePending.vbs %windir%\setupact.log
cscript %windir%\Setup\Scripts\RemovePending.vbs %windir%\Logs\DPX\setupact.log
cscript %windir%\Setup\Scripts\RemovePending.vbs %windir%\Panther\setupact.log
cscript %windir%\Setup\Scripts\RemovePending.vbs %windir%\Panther\UnattendGC\setupact.log
cscript %windir%\Setup\Scripts\RemovePending.vbs %windir%\setuperr.log
cscript %windir%\Setup\Scripts\RemovePending.vbs %windir%\Logs\DPX\setuperr.log
cscript %windir%\Setup\Scripts\RemovePending.vbs %windir%\Panther\setuperr.log
cscript %windir%\Setup\Scripts\RemovePending.vbs %windir%\Panther\UnattendGC\setuperr.log

shutdown /r /t 30

I noticed, however, that some files not are deleted as the %windir%\setupact.log and %windir%\setuperr.log files and the %windir%\Setup\Scripts directory. Why?

P.S: If, however, having finished the installation, I write one of the following commands (%windir%\Setup\Scripts\RemovePending.vbs %windir%\setupact.log or %windir%\Setup\Scripts\RemovePending.vbs %windir%\setuperr.log or %windir%\Setup\Scripts\RemovePending.vbs %windir%\Setup\Scripts )from the command prompt of the administrator, the next time that I restart Vista, these objects are removed as scheduled.

THANKS

BYE

Edited by balubeto


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.