Code: @echo off setlocal enabledelayedexpansion chcp 65001 >nul set "input=%*" if "%input%"=="" ( echo Usage: SetDefaultUserFolder.cmd ^<value^> echo Example: SetDefaultUserFolder.cmd MyFolderName exit /b 1 ) :: Now call PowerShell for detailed Unicode and reserved name validation powershell -NoProfile -Command ^ "$name = '%input%'.Trim();" ^ "$invalid = [System.IO.Path]::GetInvalidFileNameChars() + @('@', '.', ';', '=', ',', '+');" ^ "if ([string]::IsNullOrWhiteSpace($name)) { Write-Host '[ERROR] Name is empty or whitespace.'; exit 1 }" ^ "elseif ($name.Length -gt 16) { Write-Host '[ERROR] Name exceeds 16 character limit.'; exit 2 }" ^ "elseif ($name.EndsWith(' ') -or $name.EndsWith('.')) { Write-Host '[ERROR] Name cannot end with space or dot.'; exit 1 }" ^ "elseif ('CON','PRN','AUX','NUL','COM1','COM2','COM3','COM4','COM5','COM6','COM7','COM8','COM9','LPT1','LPT2','LPT3','LPT4','LPT5','LPT6','LPT7','LPT8','LPT9' -contains $name.ToUpper()) { Write-Host \"[ERROR] '$name' is a reserved name.\"; exit 1 }" ^ "elseif ($invalidChar = $name.ToCharArray() | Where-Object { $invalid -contains $_ } | Select-Object -First 1) { Write-Host \"[ERROR] Invalid character found in name: '$invalidChar'\"; exit 1 }" ^ "else { Write-Host \"[OK] '$name' is a valid folder name.\" }" if errorlevel 1 ( echo [ERROR] Folder name validation failed in PowerShell. exit /b 4 ) :: Write to registry reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\UserOOBE /v SetSAMFolderName /t REG_SZ /d "%input%" /f >nul if %errorlevel% EQU 0 ( echo [SUCCESS] Default user folder set to: %input% ) else ( echo [ERROR] Failed to set registry value. %errorlevel% exit /b 5 ) exit /b 0
Why enabledelayedexpansion if you don't intend to use it? "%input%" comparison might fail if it contains invalid characters
Exactly! Hence, why I asked how can one have sharp edges? Also, how can one have multiple town weather forecasts (live tiles) on the start menu like on W10? Is that possible on W11?
Are they still allowing interns to write PS code? -contains is case-insensitive, so why bother with $name.ToUpper() ?
Can someone confirm if the enablement package MSU safe to install on my Windows 11 24H2 to get it too "25H2"? Also, when is it expected to be released? --> "windows11.0-kb5054156-x64_a0c1638cbcf4cf33dbe9a5bef69db374b4786974.msu"
It's safe because it doesn't do anything. The "updates" are already installed in your system; this just enables GUI changes to catch up. It's a nothing burger.
Get the latest updates as soon as they are available Some didn't have it, and by enabling this option, they got it
With 25H2 it is probably the same as with previous "new" feature upgrades, newest (OEM) hardware first then older and selfbuild systems.
Is that really ? Microsoft has indeed tightened the reins in Windows 11 25H2 (build 26200.2672) by enforcing the requirement for a Microsoft account (MSA) during the Out-of-Box Experience (OOBE) setup process. No Local Account Option: The traditional method of bypassing MSA by disconnecting from the internet or using generic usernames like oobe\bypassnro no longer works in this build. All Editions Affected: Even Windows 11 Pro, which previously allowed local account setup when offline, now enforces MSA sign-in during setup. Workarounds Blocked: Microsoft has patched most known bypasses, including registry tweaks and command-line tricks during setup. what about Education Edition and IOT Enterprise S?
This is what i do : 1. create a MSA account 2. Open a session with MSA account and create a local account 3. Switch to local account and delete MSA account