SetupComplete.cmd is not deleted automatically

BKPB

Member
Messages
91
Reaction score
10
SetupComplete.cmd is not deleted automatically. SetupComplete.cmd and the folder $OEM$\$$\Setup\Scripts in which it is located are no longer automatically deleted. In doing so, it deletes the FilesU folder.
What could be the reason? Maybe in the encoding ?

Here is the script itself:
echo off
mode 155, 60

CD "%TEMP%"&CLS&@TITLE
cscript "%WINDIR%\Setup\FilesU\Hide_Folders.vbs"
cscript "%WINDIR%\Setup\FilesU\Label_System.vbs"

rd /q /s "%WINDIR%\Setup\FilesU"
rd /q /s "%WINDIR%\Setup\Scripts"
del /q /f "%0"


Installing Windows 11
 
1. Are you manually creating SetupComplete.cmd?

On PC's where an OEM license key is detected in BIOS (Dell, HP, Lenovo), Windows will skip running SetupComplete. When NTLite writes the file, it creates a postoobe task to force the script to run on all PC's.

You can confirm if SetupComplete is called, by adding a new line in the script:
Code:
echo Script is running > C:\Windows\Setup\log.txt

2. SetupComplete is normally not visible on W11, because it's hidden behind the "splash" screen. So changing its visual appearance doesn't do anything useful.
 
After the settings .wim using the NTLite program, the $OEM$ folder was created in the sources folder.
And in it
$OEM$\$$\Setup\Scripts\SetupComplete.cmd
$OEM$\$$\Setup\Files\Label_System.vbs
How to check if there is such a command in the image.and if there is no wim, then how do I add such a task to postoobe?
 
When you add a Post-Setup (Before logon) task, NTLite will automatically create SetupComplete.cmd for you, and schedule it as a postoobe task. It's simpler for you to allow NTLite to manage this work, because it also copies any submitted files to the \Windows\Setup staging folder.

Instead of editing SetupComplete, a better solution is write your own private batch script. Run this script from Post-Setup. This way you still have control over the script's contents, but NTLite does all the SetupComplete overhead.

If you prefer to do your own postoobe scheduling, add this .reg file to Registry:
Code:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\Setup\FirstBoot\PostOobe]
"00"="cmd.exe /c C:\\Windows\\Setup\\Scripts\\setupcomplete.cmd & exit /b 0 "

Copy your own files to the ISO folder's "\sources\$OEM$\$$\Scripts" directory.
 
1. Thanks for the advice, I'll use it.
As for SetupComplete, I don't create the script manually, the NTLite program creates it.
Here is the script created by the program:

@ECHO OFF
CD "%TEMP%"&CLS&@TITLE
cscript "%WINDIR%\Setup\Files\Hide_Folders.vbs"
cscript "%WINDIR%\Setup\Files\Label_System.vbs"
rd /q /s "%WINDIR%\Setup\Files"
del /q /f "%0".

This problem occurred recently during the installation of Windows 11. The files are copied to the intermediate folder \Windows\Setup and are located there, but the script does not run automatically. In the \Windows\Setup package, after the Windows installation is completed, there are folders: Files\Hide_Folders.vbs + Label_System.vbs and Script/SetupComplete.cmd. I can't figure out what the reason is.


2. Should this registry file be applied at the IN image.wim stage, BEFORE logging in or AFTER logging in ?

Windows Registry Editor version 5.00<br><br>[HKEY_LOCAL_MACHINE\SYSTEM\Setup\FirstBoot\PostOobe]<br>"00"="cmd.exe /c C:\\Windows\\Setup\\Scripts\\setupcomplete.cmd &amp; exit /b 0 "
1  28_01_2026.png
 
Last edited:
OK. I think understand the problem. NTLite is probably doing the right thing.

Did you enable the security policy to allow Scripting Host to run?
Code:
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings]
"Enabled"=dword:00000001
 
Back
Top