From 94db48af18891dfcf065cd5a5bd4dafaafcaf20c Mon Sep 17 00:00:00 2001
From: JG <it@hgw-tornesch.de>
Date: Thu, 6 Oct 2022 14:20:41 +0200
Subject: [PATCH] Apparently, the cool kids use .cmd since 2012 or sth. The
 reasons I've read up on and even though they are so minor in 2022 that I
 really shouldn't care, I am very obedient to conventions and rules - and I
 wanna be a cool kid, too.

---
 ...s.bat => 0.1_CreateDefaultAssociations.cmd |   0
 1_Preperations.bat => 1_Preperations.cmd      |  28 +--
 2_Sysprep.bat => 2_Sysprep.cmd                |   6 +-
 3_CreateImage.bat => 3_CreateImage.cmd        |  10 +-
 4_SplitImage.bat => 4_SplitImage.cmd          |   6 +-
 ...nstallation.bat => A_StartInstallation.cmd |  14 +-
 B_FixDefault.bat => B_FixDefault.cmd          |  10 +-
 README.md                                     |  22 +--
 .../{EmptyDefault.bat => EmptyDefault.cmd}    | 162 +++++++++---------
 ...ixDefault.bat => X_EmergencyFixDefault.cmd |  30 ++--
 10 files changed, 144 insertions(+), 144 deletions(-)
 rename 0.1_CreateDefaultAssociations.bat => 0.1_CreateDefaultAssociations.cmd (100%)
 rename 1_Preperations.bat => 1_Preperations.cmd (97%)
 rename 2_Sysprep.bat => 2_Sysprep.cmd (97%)
 rename 3_CreateImage.bat => 3_CreateImage.cmd (79%)
 rename 4_SplitImage.bat => 4_SplitImage.cmd (96%)
 rename A_StartInstallation.bat => A_StartInstallation.cmd (98%)
 rename B_FixDefault.bat => B_FixDefault.cmd (95%)
 rename ScriptFiles/{EmptyDefault.bat => EmptyDefault.cmd} (96%)
 rename X_EmergencyFixDefault.bat => X_EmergencyFixDefault.cmd (95%)

diff --git a/0.1_CreateDefaultAssociations.bat b/0.1_CreateDefaultAssociations.cmd
similarity index 100%
rename from 0.1_CreateDefaultAssociations.bat
rename to 0.1_CreateDefaultAssociations.cmd
diff --git a/1_Preperations.bat b/1_Preperations.cmd
similarity index 97%
rename from 1_Preperations.bat
rename to 1_Preperations.cmd
index 04f214b..8f9a492 100644
--- a/1_Preperations.bat
+++ b/1_Preperations.cmd
@@ -1,14 +1,14 @@
-@echo off
-pushd %~dp0
-robocopy "ScriptFiles" "%localappdata%\Microsoft\Windows\Shell" "LayoutModification.xml"
-robocopy "ScriptFiles" "C:\Install" "unattend.xml"
-robocopy "ScriptFiles" "C:\ProgramData\Install" "DefaultAssociations.xml"
-
-reg import "ScriptFiles\Deactivate AeroShake.reg"
-reg import "ScriptFiles\Deactivate Start Menu Web Search.reg"
-reg import "ScriptFiles\Deactivate News & Meet.reg"
-reg import "ScriptFiles\Set Default Apps.reg"
-
-popd
-pause
-exit
+@echo off
+pushd %~dp0
+robocopy "ScriptFiles" "%localappdata%\Microsoft\Windows\Shell" "LayoutModification.xml"
+robocopy "ScriptFiles" "C:\Install" "unattend.xml"
+robocopy "ScriptFiles" "C:\ProgramData\Install" "DefaultAssociations.xml"
+
+reg import "ScriptFiles\Deactivate AeroShake.reg"
+reg import "ScriptFiles\Deactivate Start Menu Web Search.reg"
+reg import "ScriptFiles\Deactivate News & Meet.reg"
+reg import "ScriptFiles\Set Default Apps.reg"
+
+popd
+pause
+exit
diff --git a/2_Sysprep.bat b/2_Sysprep.cmd
similarity index 97%
rename from 2_Sysprep.bat
rename to 2_Sysprep.cmd
index 6213aaf..6c8b56a 100644
--- a/2_Sysprep.bat
+++ b/2_Sysprep.cmd
@@ -1,3 +1,3 @@
-@echo off
-start C:\Windows\System32\Sysprep\sysprep.exe /oobe /generalize /shutdown /unattend:C:\Install\unattend.xml
-exit
+@echo off
+start C:\Windows\System32\Sysprep\sysprep.exe /oobe /generalize /shutdown /unattend:C:\Install\unattend.xml
+exit
diff --git a/3_CreateImage.bat b/3_CreateImage.cmd
similarity index 79%
rename from 3_CreateImage.bat
rename to 3_CreateImage.cmd
index a812277..4cc402b 100644
--- a/3_CreateImage.bat
+++ b/3_CreateImage.cmd
@@ -1,5 +1,5 @@
-@echo off
-start /b /w %~dp0\ScriptFiles\EmptyDefault.bat
-rd /q /s C:\Install
-mkdir D:\Scratch
-dism /Capture-Image /ImageFile:D:\install.wim /CaptureDir:C:\ /ScratchDir:D:\Scratch /name:"CustomWin10Pro" /compress:Max /CheckIntegrity /verify /bootable
+@echo off
+start /b /w %~dp0\ScriptFiles\EmptyDefault.cmd
+rd /q /s C:\Install
+mkdir D:\Scratch
+dism /Capture-Image /ImageFile:D:\install.wim /CaptureDir:C:\ /ScratchDir:D:\Scratch /name:"CustomWin10Pro" /compress:Max /CheckIntegrity /verify /bootable
diff --git a/4_SplitImage.bat b/4_SplitImage.cmd
similarity index 96%
rename from 4_SplitImage.bat
rename to 4_SplitImage.cmd
index 1baf0b9..6e1009e 100644
--- a/4_SplitImage.bat
+++ b/4_SplitImage.cmd
@@ -1,3 +1,3 @@
-dism /Split-Image /ImageFile:D:\install.wim /SWMFile:D:\install.swm /FileSize:4000
-pause
-exit
+dism /Split-Image /ImageFile:D:\install.wim /SWMFile:D:\install.swm /FileSize:4000
+pause
+exit
diff --git a/A_StartInstallation.bat b/A_StartInstallation.cmd
similarity index 98%
rename from A_StartInstallation.bat
rename to A_StartInstallation.cmd
index a0e8300..33f2f17 100644
--- a/A_StartInstallation.bat
+++ b/A_StartInstallation.cmd
@@ -1,7 +1,7 @@
-@echo off
-diskpart /s %~d0\ScriptFiles\CreatePartitions.dps
-dism /Apply-Image /ImageFile:%~d0\sources\install.swm /SWMFile:%~d0\sources\install*.swm /Index:1 /ApplyDir:W:\ /CheckIntegrity /Verify
-bcdboot W:\Windows /s S:
-md R:\Recovery\WindowsRE
-copy %~d0\ScriptFiles\winre.wim R:\Recovery\WindowsRE
-W:\Windows\System32\ReAgentc.exe /SetReImage /Path R:\Recovery\WindowsRE /Target W:\Windows
+@echo off
+diskpart /s %~d0\ScriptFiles\CreatePartitions.dps
+dism /Apply-Image /ImageFile:%~d0\sources\install.swm /SWMFile:%~d0\sources\install*.swm /Index:1 /ApplyDir:W:\ /CheckIntegrity /Verify
+bcdboot W:\Windows /s S:
+md R:\Recovery\WindowsRE
+copy %~d0\ScriptFiles\winre.wim R:\Recovery\WindowsRE
+W:\Windows\System32\ReAgentc.exe /SetReImage /Path R:\Recovery\WindowsRE /Target W:\Windows
diff --git a/B_FixDefault.bat b/B_FixDefault.cmd
similarity index 95%
rename from B_FixDefault.bat
rename to B_FixDefault.cmd
index 6981e1d..50569ec 100644
--- a/B_FixDefault.bat
+++ b/B_FixDefault.cmd
@@ -1,5 +1,5 @@
-@echo off
-rd /s /q "C:\Users\Default\AppData\Local\Microsoft\Windows\WebCache"
-echo Done.
-pause
-exit
+@echo off
+rd /s /q "C:\Users\Default\AppData\Local\Microsoft\Windows\WebCache"
+echo Done.
+pause
+exit
diff --git a/README.md b/README.md
index 299fd7e..9d2b127 100644
--- a/README.md
+++ b/README.md
@@ -23,26 +23,26 @@ The second part is adapted from [this post on the TenForums](https://www.tenforu
 	6. Go the normal program list and uninstall any additional unwanted programs (e.g. OneDrive).
 5. Install programs to provide by default (e.g. Firefox, MS Office, ...).
 6. Configure these programs' settings (e.g. config and install Addons in Firefox) and make them default for their filetypes if wanted.
-	* If a program you're using saves it's settings in `AppData`, add the corresponding folder/file in the `EmptyDefault.bat` from `ScriptFiles`.
-7. Run `0.1_CreateDefaultAssociations.bat`.
+	* If a program you're using saves it's settings in `AppData`, add the corresponding folder/file in the `EmptyDefault.cmd` from `ScriptFiles`.
+7. Run `0.1_CreateDefaultAssociations.cmd`.
 8. Run `0.2_CreateDefaultStartMenuLayout.ps1`.
 	* If that doesn't work, run `Export-StartLayout -Path C:\LayoutModification.xml` in an elevated PowerShell.
 10. Open `C:\defaultassociations.xml` and edit it according to the wanted default file associations. (An example is provided in `ScriptFiles`.)
 11. Open `C:\LayoutModification.xml` and [add the Taskbar Layout as needed](https://docs.microsoft.com/en-us/windows/configuration/configure-windows-10-taskbar#sample-taskbar-configuration-added-to-start-layout-xml-file) [[Archived link](https://web.archive.org/web/20220121115213/https://docs.microsoft.com/en-us/windows/configuration//configure-windows-10-taskbar#sample-taskbar-configuration-added-to-start-layout-xml-file)].
 	* An example is provided in `ScriptFiles`.
 13. Cut & paste your modified XMLs from 8. & 9. into the `ScriptFiles` folder, replacing my default ones.
-14. Run `1_Preparations.bat` elevated.
+14. Run `1_Preparations.cmd` elevated.
 15. Run the partition manager.
 16. Shrink your main partition by 15-25 GB.
 17. Create a new partition with this space called `Install`.
-18. Run `2_Sysprep.bat` elevated and wait for the system to shut down.
+18. Run `2_Sysprep.cmd` elevated and wait for the system to shut down.
 19. Start your system from the USB stick.
 20. In the installation screen, press `Shift+F10` to open the command prompt.
-21. Use `E:` (probably) to change to your stick and `cd` to the directory the batch files are located in.
-22. Run `3_CreateImage.bat` (from the command line). This will take a while (> 20 min probably, so go make yourself a coffee or whatever).
+21. Use `E:` (probably) to change to your stick and `cd` to the directory the.cmdch files are located in.
+22. Run `3_CreateImage.cmd` (from the command line). This will take a while (> 20 min probably, so go make yourself a coffee or whatever).
 23. Close command line and installation window and reboot your system normally.
 24. Go through the first user creation process until you reach the desktop.
-25. Open the USB stick and run `4_SplitImage.bat`. This will again take a short while (> 5 min probably).
+25. Open the USB stick and run `4_SplitImage.cmd`. This will again take a short while (> 5 min probably).
 26. Open the `sources` folder on your USB stick and delete `install.wim` from it.
 27. Open the *Install* partition in file explorer.
 28. Copy all `.swm` files (not the `.wim` file) into the sources dir of your stick.
@@ -67,10 +67,10 @@ Because of the split image and the nature of custom installations, a few things
 1. Plug in your USB stick from above into a new PC.
 2. Boot from the USB stick.
 3. In the installation screen, press `Shift+F10` to open the command prompt.
-4. Use `D:` (probably now) to change to your USB stick and `cd` to the directory the batch files are located in.
-5. Run `A_StartInstallation.bat`. This will take a while (> 15 min probably, go get a second refreshment if you like).
+4. Use `D:` (probably now) to change to your USB stick and `cd` to the directory the.cmdch files are located in.
+5. Run `A_StartInstallation.cmd`. This will take a while (> 15 min probably, go get a second refreshment if you like).
 6. Close command line and installation window and reboot your system normally.
 7. Got through the first user creation process until you reach the desktop.
-8. **Important!** Run `B_FixDefault.bat` elevated.<br>
+8. **Important!** Run `B_FixDefault.cmd` elevated.<br>
 	**If you don't do this step, new logins will take ages and won't work correctly the first few times.**<br>
-	If you forget this step, you can run `X_EmergencyFixDefault.bat` elevated on any user to fix it for future users.
+	If you forget this step, you can run `X_EmergencyFixDefault.cmd` elevated on any user to fix it for future users.
diff --git a/ScriptFiles/EmptyDefault.bat b/ScriptFiles/EmptyDefault.cmd
similarity index 96%
rename from ScriptFiles/EmptyDefault.bat
rename to ScriptFiles/EmptyDefault.cmd
index 9014b0a..e55de79 100644
--- a/ScriptFiles/EmptyDefault.bat
+++ b/ScriptFiles/EmptyDefault.cmd
@@ -1,82 +1,82 @@
-@echo off
-pushd C:\Users\Default\AppData && (
-rem takeown /f local\Microsoft\WindowsApps /r /a /d J
-rem icacls local\Microsoft\WindowsApps /grant Administrators:F /T /C /L
-rd /q /s LocalLow
-mkdir LocalLow
-popd
-)
-pushd "C:\Users\Default\AppData\Local\Microsoft\Windows" && (
-for /f "tokens=*" %%a in ('dir /A:D /b') do (
-  if not "%%a" == "Shell" if not "%%a" == "WinX" (
-  rd /s /q "%%a"
-  )
-)
-del /f /q *.* 2> nul
-del /f /q /ah *.* 2> nul
-popd
-)
-pushd "C:\Users\Default\AppData\Local\Microsoft\Office" && (
-for /f "tokens=*" %%b in ('dir /A:D /b') do (
-  if not "%%a" == "Personalization" (
-  rd /s /q "%%b"
-  )
-)
-popd
-)
-pushd "C:\Users\Default\AppData\Local\Microsoft\" && (
-for /f "tokens=*" %%c in ('dir /A:D /b') do (
-  if not "%%c" == "Windows" if not "%%c" == "Office" if not "%%c" == "Teams" (
-  rd /s /q "%%c"
-  )
-)
-del /f /q *.* 2> nul
-del /f /q /ah *.* 2> nul
-popd
-)
-pushd "C:\Users\Default\AppData\Local\" && (
-for /f "tokens=*" %%d in ('dir /A:D /b') do (
-  if not "%%d" == "Microsoft" (
-  rd /s /q "%%d"
-  )
-)
-del /f /q *.* 2> nul
-del /f /q /ah *.* 2> nul
-popd
-)
-pushd "C:\Users\Default\AppData\Roaming\Microsoft\Windows" && (
-for /f "tokens=*" %%e in ('dir /A:D /b') do (
-  if not "%%e" == "Start Menu" if not "%%e" == "SendTo" (
-  rd /s /q "%%e"
-  )
-)
-del /f /q *.* 2> nul
-del /f /q /ah *.* 2> nul
-popd
-)
-pushd "C:\Users\Default\AppData\Roaming\Microsoft" && (
-for /f "tokens=*" %%f in ('dir /A:D /b') do (
-  if not "%%f" == "Windows" (
-  rd /s /q "%%f"
-  )
-)
-del /f /q *.* 2> nul
-del /f /q /ah *.* 2> nul
-popd
-)
-pushd "C:\Users\Default\AppData\Roaming" && (
-for /f "tokens=*" %%i in ('dir /A:D /b') do (
-  if not "%%i" == "Microsoft" if not "%%i" == "Mozilla" (
-  rd /s /q "%%i"
-  )
-)
-del /f /q *.* 2> nul
-del /f /q /ah *.* 2> nul
-popd
-)
-for /r %%j in (*.log*) do del /q /f /ah %%j del /q /f %%j
-for /r %%k in (*.blf*) do del /q /f /ah %%k del /q /f %%k
-for /r %%l in (*.REGTRANS-MS) do del /q /f /ah %%l del /q /f %%l
-
-echo Default profile cleaned up.
+@echo off
+pushd C:\Users\Default\AppData && (
+rem takeown /f local\Microsoft\WindowsApps /r /a /d J
+rem icacls local\Microsoft\WindowsApps /grant Administrators:F /T /C /L
+rd /q /s LocalLow
+mkdir LocalLow
+popd
+)
+pushd "C:\Users\Default\AppData\Local\Microsoft\Windows" && (
+for /f "tokens=*" %%a in ('dir /A:D /b') do (
+  if not "%%a" == "Shell" if not "%%a" == "WinX" (
+  rd /s /q "%%a"
+  )
+)
+del /f /q *.* 2> nul
+del /f /q /ah *.* 2> nul
+popd
+)
+pushd "C:\Users\Default\AppData\Local\Microsoft\Office" && (
+for /f "tokens=*" %%b in ('dir /A:D /b') do (
+  if not "%%a" == "Personalization" (
+  rd /s /q "%%b"
+  )
+)
+popd
+)
+pushd "C:\Users\Default\AppData\Local\Microsoft\" && (
+for /f "tokens=*" %%c in ('dir /A:D /b') do (
+  if not "%%c" == "Windows" if not "%%c" == "Office" if not "%%c" == "Teams" (
+  rd /s /q "%%c"
+  )
+)
+del /f /q *.* 2> nul
+del /f /q /ah *.* 2> nul
+popd
+)
+pushd "C:\Users\Default\AppData\Local\" && (
+for /f "tokens=*" %%d in ('dir /A:D /b') do (
+  if not "%%d" == "Microsoft" (
+  rd /s /q "%%d"
+  )
+)
+del /f /q *.* 2> nul
+del /f /q /ah *.* 2> nul
+popd
+)
+pushd "C:\Users\Default\AppData\Roaming\Microsoft\Windows" && (
+for /f "tokens=*" %%e in ('dir /A:D /b') do (
+  if not "%%e" == "Start Menu" if not "%%e" == "SendTo" (
+  rd /s /q "%%e"
+  )
+)
+del /f /q *.* 2> nul
+del /f /q /ah *.* 2> nul
+popd
+)
+pushd "C:\Users\Default\AppData\Roaming\Microsoft" && (
+for /f "tokens=*" %%f in ('dir /A:D /b') do (
+  if not "%%f" == "Windows" (
+  rd /s /q "%%f"
+  )
+)
+del /f /q *.* 2> nul
+del /f /q /ah *.* 2> nul
+popd
+)
+pushd "C:\Users\Default\AppData\Roaming" && (
+for /f "tokens=*" %%i in ('dir /A:D /b') do (
+  if not "%%i" == "Microsoft" if not "%%i" == "Mozilla" (
+  rd /s /q "%%i"
+  )
+)
+del /f /q *.* 2> nul
+del /f /q /ah *.* 2> nul
+popd
+)
+for /r %%j in (*.log*) do del /q /f /ah %%j del /q /f %%j
+for /r %%k in (*.blf*) do del /q /f /ah %%k del /q /f %%k
+for /r %%l in (*.REGTRANS-MS) do del /q /f /ah %%l del /q /f %%l
+
+echo Default profile cleaned up.
 exit
\ No newline at end of file
diff --git a/X_EmergencyFixDefault.bat b/X_EmergencyFixDefault.cmd
similarity index 95%
rename from X_EmergencyFixDefault.bat
rename to X_EmergencyFixDefault.cmd
index b00d3c8..d6df1d5 100644
--- a/X_EmergencyFixDefault.bat
+++ b/X_EmergencyFixDefault.cmd
@@ -1,15 +1,15 @@
-@echo off
-pushd "C:\Users" && (
-for /f "tokens=*" %%a in ('dir /A:D /b') do (
-  if not "%%a" == "Public" if not "%%a" == "All Users" if not "%%a" == "Default User" (
-    pushd "C:\Users\%%a\AppData\Local\Microsoft\Windows" && (
-      rd /s /q WebCache
-      del /q /f WebCacheLock.dat
-    )
-    popd
-  )
-)
-popd
-)
-pause
-exit
+@echo off
+pushd "C:\Users" && (
+for /f "tokens=*" %%a in ('dir /A:D /b') do (
+  if not "%%a" == "Public" if not "%%a" == "All Users" if not "%%a" == "Default User" (
+    pushd "C:\Users\%%a\AppData\Local\Microsoft\Windows" && (
+      rd /s /q WebCache
+      del /q /f WebCacheLock.dat
+    )
+    popd
+  )
+)
+popd
+)
+pause
+exit
-- 
GitLab