From 45d36e7b96260a2fadcb913ab3928b2cf63d36de Mon Sep 17 00:00:00 2001 From: SegoCode <35817798+SegoCode@users.noreply.github.com> Date: Sun, 4 Aug 2024 15:47:13 +0200 Subject: [PATCH 01/14] Update downloadcenter with scoop installer --- code/launcher.ps1 | 7 ++- code/modules/downloadcenter.bat | 84 ++++++++++++++++++++----------- code/modules/utils/chibiScoop.ps1 | 4 +- 3 files changed, 63 insertions(+), 32 deletions(-) diff --git a/code/launcher.ps1 b/code/launcher.ps1 index f5ee7b4..818d0d1 100644 --- a/code/launcher.ps1 +++ b/code/launcher.ps1 @@ -6,8 +6,11 @@ param ( if ([string]::IsNullOrWhiteSpace($batchFilePath) -eq $false -and $batchFilePath.Length -gt 0) { # Now, safely check if the file exists if (Test-Path -Path $batchFilePath) { - # If the file exists, run it as administrator - Start-Process $batchFilePath -Verb RunAs + if ($batchFilePath -notmatch "downloadcenter") { + Start-Process $batchFilePath -Verb RunAs + } else { + Start-Process $batchFilePath + } } } else { # This workflow will be triggered to obtain deblobat over the internet with a command diff --git a/code/modules/downloadcenter.bat b/code/modules/downloadcenter.bat index ca56f3b..c580115 100644 --- a/code/modules/downloadcenter.bat +++ b/code/modules/downloadcenter.bat @@ -14,9 +14,11 @@ echo. echo This tool utilizes Scoop repositories to fetch the latest echo versions of software. It won't install the software, echo instead, it creates an installation folder on your -echo desktop where the downloads are saved. You can then -echo decide how to proceed with the installers. If you want +echo desktop where the downloads are saved. If you want echo you can install scoop by typing "scoop" as input. +echo If scoop are Enabled it will install the software +echo using scoop. + echo. ping -n 2 8.8.8.8 > nul if not %errorlevel% == 1 ( @@ -28,27 +30,29 @@ if not %errorlevel% == 1 ( where scoop >nul 2>nul if %errorlevel% == 0 ( echo Scoop installation = [ Enabled ] + set "scoopInstalled=true" ) else ( echo Scoop installation = [ Disabled ] + set "scoopInstalled=false" ) echo. cd %~dp0 -echo [1] Mozilla Firefox = [ Download ] -echo [2] VLC Media Player = [ Download ] -echo [3] 7-Zip = [ Download ] -echo [4] qBittorrent Enhanced = [ Download ] -echo [5] Steam = [ Download ] -echo [6] Discord = [ Download ] -echo [7] File Converter = [ Download ] -echo [8] Telegram = [ Download ] -echo [9] Spotify = [ Download ] -echo [10] SimpleWall = [ Download ] -echo [11] Ungoogled Chromium = [ Download ] -echo [12] Brave Browser = [ Download ] -echo [13] qView = [ Download ] -echo [14] Sublime Text = [ Download ] -echo [15] Flameshot = [ Download ] +echo [1] Librewolf = [ Launch ] +echo [2] VLC Media Player = [ Launch ] +echo [3] 7-Zip = [ Launch ] +echo [4] qBittorrent Enhanced = [ Launch ] +echo [5] Steam = [ Launch ] +echo [6] Discord = [ Launch ] +echo [7] File Converter = [ Launch ] +echo [8] Telegram = [ Launch ] +echo [9] Spotify = [ Launch ] +echo [10] SimpleWall = [ Launch ] +echo [11] Ungoogled Chromium = [ Launch ] +echo [12] Brave Browser = [ Launch ] +echo [13] qView = [ Launch ] +echo [14] Sublime Text = [ Launch ] +echo [15] Flameshot = [ Launch ] echo. echo [0] Return to menu @@ -59,20 +63,39 @@ set /P N=Select your task and press Enter ^> setlocal cls -powershell "Set-ExecutionPolicy Unrestricted -force 2>&1 | Out-Null" > nul 2>&1 - if %N%==1 ( - powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "firefox" + if "%scoopInstalled%"=="true" ( + start powershell -NoExit -Command "scoop install extras/librewolf" + pause + ) else ( + powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "librewolf" + ) ) + if %N%==2 ( - powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "vlc" + if "%scoopInstalled%"=="true" ( + start powershell -NoExit -Command "scoop install extras/vlc" + ) else ( + powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "vlc" + ) ) + if %N%==3 ( - powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "7zip" + if "%scoopInstalled%"=="true" ( + start powershell -NoExit -Command "scoop install main/7zip" + ) else ( + powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "7zip" + ) ) + if %N%==4 ( - powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "qbittorrent-enhanced" + if "%scoopInstalled%"=="true" ( + start powershell -NoExit -Command "scoop install extras/qbittorrent-enhanced" + ) else ( + powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "qbittorrent-enhanced" + ) ) + if %N%==5 ( powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "steam" ) @@ -107,11 +130,16 @@ if %N%==15 ( powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "flameshot" ) -if /i "%N%"=="scoop" ( - reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v "LongPathsEnabled" /t REG_DWORD /d 1 /f > nul 2>&1 - powershell -Command "Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression" - pause -) +::if /i "%N%"=="scoop" ( +:: :: Non RunAs version +:: :: powershell "Set-ExecutionPolicy Unrestricted -force 2>&1 | Out-Null" > nul 2>&1 +:: :: reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v "LongPathsEnabled" /t REG_DWORD /d 1 /f > nul 2>&1 +:: +:: powershell -Command "Start-Process powershell -ArgumentList '\"Set-ExecutionPolicy Unrestricted -force 2>&1 | Out-Null\"' -Verb RunAs" +:: powershell -Command "Start-Process reg -ArgumentList '\"add HKLM\\SYSTEM\\CurrentControlSet\\Control\\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f\"' -Verb RunAs" +:: powershell -Command "Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression" +:: pause +::) if %N%==0 (goto EOF) endlocal diff --git a/code/modules/utils/chibiScoop.ps1 b/code/modules/utils/chibiScoop.ps1 index a2d8972..5fc7353 100644 --- a/code/modules/utils/chibiScoop.ps1 +++ b/code/modules/utils/chibiScoop.ps1 @@ -4,7 +4,7 @@ param( # Dictionary mapping software names to metadata URLs $urlDictionary = @{ - "firefox" = "https://raw.githubusercontent.com/ScoopInstaller/Extras/master/bucket/firefox.json" + "librewolf" = "https://raw.githubusercontent.com/ScoopInstaller/Extras/master/bucket/librewolf.json" "vlc" = "https://raw.githubusercontent.com/ScoopInstaller/Extras/master/bucket/vlc.json" "7zip" = "https://raw.githubusercontent.com/ScoopInstaller/Main/master/bucket/7zip.json" "qbittorrent-enhanced"= "https://raw.githubusercontent.com/ScoopInstaller/Extras/master/bucket/qbittorrent-enhanced.json" @@ -59,4 +59,4 @@ $destinationPath = Join-Path $destinationFolder $fileName # Download the file using curl.exe curl.exe -L $downloadUrl -o $destinationPath -Write-Host "Download completed: $destinationPath" \ No newline at end of file +Write-Host "Download completed: $destinationPath" From 517671be624f5d44e36ceb8fa2b4166b60c6c50d Mon Sep 17 00:00:00 2001 From: SegoCode <35817798+SegoCode@users.noreply.github.com> Date: Sun, 4 Aug 2024 15:58:43 +0200 Subject: [PATCH 02/14] Add AppCaptureEnabled --- code/modules/qolconfig.bat | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/code/modules/qolconfig.bat b/code/modules/qolconfig.bat index d55f28f..70eb81c 100644 --- a/code/modules/qolconfig.bat +++ b/code/modules/qolconfig.bat @@ -159,6 +159,14 @@ if not %errorlevel% == 1 ( ) +reg query "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR" /v AppCaptureEnabled > nul 2>&1 && ( + reg query "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR" /v AppCaptureEnabled | find "0x0" > nul 2>&1 +) +if not %errorlevel% == 1 ( + echo [17] Gaming overlay popup = [ Disabled ] +) else ( + echo [17] Gaming overlay popup = [ Enabled ] +) echo. @@ -398,6 +406,14 @@ if %N%==16 ( ) ) +if %N%==17 ( + reg query "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR" /v AppCaptureEnabled | find "0x0" > nul 2>&1 + if not !ERRORLEVEL! == 1 ( + reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR" /v AppCaptureEnabled /t REG_DWORD /d 1 /f > nul 2>&1 + ) else ( + reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR" /v AppCaptureEnabled /t REG_DWORD /d 0 /f > nul 2>&1 + ) +) endlocal From 368639f6730ff238551e6b0223b240581ffb871d Mon Sep 17 00:00:00 2001 From: SegoCode <35817798+SegoCode@users.noreply.github.com> Date: Sun, 4 Aug 2024 17:20:21 +0200 Subject: [PATCH 03/14] Update README.md --- README.md | 53 +---------------------------------------------------- 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/README.md b/README.md index 3538961..8c7e61a 100644 --- a/README.md +++ b/README.md @@ -35,58 +35,7 @@ git clone https://github.com/SegoCode/DebloBat cd DebloBat\code Deblo.bat ``` -Or [donwload a zip](https://github.com/SegoCode/DebloBat/archive/refs/heads/main.zip) and click on deblo.bat file. - - -
- Why can't software installation be left unattended? Is there any way to install my software in an unattended way? - - ## - At first, the download manager had all the links to official programs handy, and I went through the documentation for each one to customize all installations silently. However, it was challenging to maintain. The "deblobat philosophy" aims to be as non-intrusive as possible, so using a package manager seemed intrusive to the system. Therefore, I simply download those binaries to make access easier for the user. - -Still, if you want to unattended that process, I recommend "scoop." In its new version, it's quite decent. Here's a text block example that you can simply copy and paste using the button into your PowerShell terminal to install the software: -```shell -# Enable long paths in Windows registry for Scoop -Start-Process powershell -ArgumentList "-Command Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1" -Verb RunAs -Wait - -# Install Scoop -Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression - -# Install essential Scoop packages -scoop install refreshenv - -scoop install 7zip -refreshenv - -scoop install git -refreshenv - -scoop install innounp -refreshenv - -scoop install wixtoolset -refreshenv - -scoop bucket add extras -scoop bucket add java -refreshenv - -# You can add or remove programs below this section as needed -scoop install java/temurin-jdk -scoop install main/nodejs-lts -scoop install main/go -scoop install extras/filezilla -scoop install extras/vlc -scoop install extras/qview -scoop install extras/qbittorrent-enhanced -scoop install extras/telegram -scoop install extras/discord -scoop install extras/sublime-text -scoop install extras/flameshot -scoop install extras/simplewall -scoop install extras/firefox -``` +Or [donwload a zip](https://github.com/SegoCode/DebloBat/archive/refs/heads/main.zip) and double click on deblo.bat file, just that.
From e2d92c64830e152765a115c45b18f8828ab3f58c Mon Sep 17 00:00:00 2001 From: SegoCode <35817798+SegoCode@users.noreply.github.com> Date: Sun, 4 Aug 2024 17:26:40 +0200 Subject: [PATCH 04/14] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8c7e61a..888a481 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Yes, I know... Here is another ugly meme script to debloat Windows, this no long ## Features -- Real and secure, easy readable code, offline Windows Activation (KMS38) +- Real and secure and easy readable code for offline Windows Activation. - Readable, well organized script, avoids a single, unreadable monolithic script. - Windows service configuration. - Privacy and QoL Group Policy tweaks. @@ -25,7 +25,7 @@ Yes, I know... Here is another ugly meme script to debloat Windows, this no long ## Quick Start & Information -Lauch option 1: +Lauch option 1 (Recommended): ```shell irm https://raw.githubusercontent.com/SegoCode/DebloBat/main/code/launcher.ps1 | iex ``` From a3ab736c240ba5d59c57c9f8e9ceb2fade08fca9 Mon Sep 17 00:00:00 2001 From: SegoCode <35817798+SegoCode@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:52:29 +0200 Subject: [PATCH 05/14] New download center with scoop --- code/launcher.ps1 | 2 +- code/modules/downloadcenter.bat | 152 ++++++++++++++++++++---------- code/modules/logs/.gitkeep | 0 code/modules/utils/RefreshEnv.cmd | 130 +++++++++++++++++++++++++ code/modules/utils/chibiScoop.ps1 | 3 +- 5 files changed, 233 insertions(+), 54 deletions(-) create mode 100644 code/modules/logs/.gitkeep create mode 100644 code/modules/utils/RefreshEnv.cmd diff --git a/code/launcher.ps1 b/code/launcher.ps1 index 818d0d1..0ba5fd7 100644 --- a/code/launcher.ps1 +++ b/code/launcher.ps1 @@ -9,7 +9,7 @@ if ([string]::IsNullOrWhiteSpace($batchFilePath) -eq $false -and $batchFilePath. if ($batchFilePath -notmatch "downloadcenter") { Start-Process $batchFilePath -Verb RunAs } else { - Start-Process $batchFilePath + Start-Process -FilePath "conhost.exe" -ArgumentList "cmd /c `"$batchFilePath`"" } } } else { diff --git a/code/modules/downloadcenter.bat b/code/modules/downloadcenter.bat index c580115..55372ff 100644 --- a/code/modules/downloadcenter.bat +++ b/code/modules/downloadcenter.bat @@ -12,12 +12,15 @@ echo Always latest version and official links echo ----------------------------------------------- echo. echo This tool utilizes Scoop repositories to fetch the latest -echo versions of software. It won't install the software, -echo instead, it creates an installation folder on your -echo desktop where the downloads are saved. If you want -echo you can install scoop by typing "scoop" as input. -echo If scoop are Enabled it will install the software -echo using scoop. +echo versions of software. +echo. +echo If scoop are enabled it will install the software +echo using scoop. You can install scoop by typing "scoop" +echo as input. If are disabled, it creates an installation +echo folder on your desktop with the software files. For more +echo info type "help" + +call utils\RefreshEnv.cmd > nul 2>&1 echo. ping -n 2 8.8.8.8 > nul @@ -38,21 +41,18 @@ if %errorlevel% == 0 ( echo. cd %~dp0 + echo [1] Librewolf = [ Launch ] echo [2] VLC Media Player = [ Launch ] -echo [3] 7-Zip = [ Launch ] +echo [3] qview = [ Launch ] echo [4] qBittorrent Enhanced = [ Launch ] -echo [5] Steam = [ Launch ] -echo [6] Discord = [ Launch ] -echo [7] File Converter = [ Launch ] -echo [8] Telegram = [ Launch ] -echo [9] Spotify = [ Launch ] -echo [10] SimpleWall = [ Launch ] -echo [11] Ungoogled Chromium = [ Launch ] -echo [12] Brave Browser = [ Launch ] -echo [13] qView = [ Launch ] -echo [14] Sublime Text = [ Launch ] -echo [15] Flameshot = [ Launch ] +echo [5] telegram = [ Launch ] +echo [6] sublime-text = [ Launch ] +echo [7] simplewall = [ Launch ] +echo [8] flameshot = [ Launch ] +echo [9] Brave = [ Launch ] +echo [10] java = [ Launch ] +echo [11] Steam (Non-scoop) = [ Launch ] echo. echo [0] Return to menu @@ -65,8 +65,7 @@ cls if %N%==1 ( if "%scoopInstalled%"=="true" ( - start powershell -NoExit -Command "scoop install extras/librewolf" - pause + powershell -Command "scoop install extras/librewolf" ) else ( powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "librewolf" ) @@ -74,7 +73,7 @@ if %N%==1 ( if %N%==2 ( if "%scoopInstalled%"=="true" ( - start powershell -NoExit -Command "scoop install extras/vlc" + powershell -Command "scoop install extras/vlc" ) else ( powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "vlc" ) @@ -82,66 +81,115 @@ if %N%==2 ( if %N%==3 ( if "%scoopInstalled%"=="true" ( - start powershell -NoExit -Command "scoop install main/7zip" + powershell -Command "scoop install extras/qview" ) else ( - powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "7zip" + powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "qview" ) ) if %N%==4 ( if "%scoopInstalled%"=="true" ( - start powershell -NoExit -Command "scoop install extras/qbittorrent-enhanced" + powershell -Command "scoop install extras/qbittorrent-enhanced" ) else ( powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "qbittorrent-enhanced" ) ) if %N%==5 ( - powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "steam" + if "%scoopInstalled%"=="true" ( + powershell -Command "scoop install extras/telegram" + ) else ( + powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "telegram" + ) ) + if %N%==6 ( - powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "discord" + if "%scoopInstalled%"=="true" ( + powershell -Command "scoop install extras/sublime-text" + ) else ( + powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "sublime-text" + ) ) + + if %N%==7 ( - powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "file-converter" + if "%scoopInstalled%"=="true" ( + powershell -Command "scoop install extras/simplewall" + ) else ( + powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "simplewall" + ) ) + + if %N%==8 ( - powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "telegram" + if "%scoopInstalled%"=="true" ( + powershell -Command "scoop install extras/flameshot" + ) else ( + powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "flameshot" + ) ) + if %N%==9 ( - powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "spotify" + if "%scoopInstalled%"=="true" ( + powershell -Command "scoop install extras/brave" + ) else ( + powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "brave" + ) ) + if %N%==10 ( - powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "simplewall" + if "%scoopInstalled%"=="true" ( + powershell -Command "scoop install java/temurin-jdk" + ) else ( + powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "java" + ) ) + if %N%==11 ( - powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "ungoogled-chromium" -) -if %N%==12 ( - powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "brave" -) -if %N%==13 ( - powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "qview" -) -if %N%==14 ( - powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "sublime-text" + powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "steam" ) -if %N%==15 ( - powershell -File ".\utils\chibiScoop.ps1" -SoftwareName "flameshot" + + +if /i "%N%"=="scoop" ( + powershell -Command "Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression" + call utils\RefreshEnv.cmd + echo. + + powershell -Command "scoop install main/7zip" + call utils\RefreshEnv.cmd + echo. + + powershell -Command "scoop install main/git" + call utils\RefreshEnv.cmd + echo. + + powershell -Command "scoop install main/innounp" + call utils\RefreshEnv.cmd + echo. + + powershell -Command "scoop install main/wixtoolset" + call utils\RefreshEnv.cmd + echo. + + powershell -Command "scoop bucket add extras" + call utils\RefreshEnv.cmd + echo. + + powershell -Command "scoop bucket add java" + call utils\RefreshEnv.cmd + echo. + + echo Scoop and the software required for its operation installed, check the log before proceeding. + pause ) -::if /i "%N%"=="scoop" ( -:: :: Non RunAs version -:: :: powershell "Set-ExecutionPolicy Unrestricted -force 2>&1 | Out-Null" > nul 2>&1 -:: :: reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v "LongPathsEnabled" /t REG_DWORD /d 1 /f > nul 2>&1 -:: -:: powershell -Command "Start-Process powershell -ArgumentList '\"Set-ExecutionPolicy Unrestricted -force 2>&1 | Out-Null\"' -Verb RunAs" -:: powershell -Command "Start-Process reg -ArgumentList '\"add HKLM\\SYSTEM\\CurrentControlSet\\Control\\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f\"' -Verb RunAs" -:: powershell -Command "Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression" -:: pause -::) +if /i "%N%"=="help" ( + start https://scoop.sh/ +) if %N%==0 (goto EOF) +echo. +pause endlocal goto DOWNLOADCENTER :EOF diff --git a/code/modules/logs/.gitkeep b/code/modules/logs/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/code/modules/utils/RefreshEnv.cmd b/code/modules/utils/RefreshEnv.cmd new file mode 100644 index 0000000..e1b0e4a --- /dev/null +++ b/code/modules/utils/RefreshEnv.cmd @@ -0,0 +1,130 @@ +:: Code generously provided by @beatcracker: https://github.com/beatcracker/detect-batch-subshell +@echo off + +setlocal EnableDelayedExpansion + +:: Dequote path to command processor and this script path +set ScriptPath=%~0 +set CmdPath=%COMSPEC:"=% + +:: Get command processor filename and filename with extension +for %%c in (!CmdPath!) do ( + set CmdExeName=%%~nxc + set CmdName=%%~nc +) + +:: Get this process' PID +:: Adapted from: http://www.dostips.com/forum/viewtopic.php?p=22675#p22675 +set "uid=" +for /l %%i in (1 1 128) do ( + set /a "bit=!random!&1" + set "uid=!uid!!bit!" +) + +for /f "tokens=2 delims==" %%i in ( + 'wmic Process WHERE "Name='!CmdExeName!' AND CommandLine LIKE '%%!uid!%%'" GET ParentProcessID /value' +) do ( + rem Get commandline of parent + for /f "tokens=1,2,*" %%j in ( + 'wmic Process WHERE "Handle='%%i'" GET CommandLine /value' + ) do ( + + rem Strip extra CR's from wmic output + rem http://www.dostips.com/forum/viewtopic.php?t=4266 + for /f "delims=" %%x in ("%%l") do ( + rem Dequote path to batch file, if any (3rd argument) + set ParentScriptPath=%%x + set ParentScriptPath=!ParentScriptPath:"=! + ) + + rem Get parent process path + for /f "tokens=2 delims==" %%y in ("%%j") do ( + rem Dequote parent path + set ParentPath=%%y + set ParentPath=!ParentPath:"=! + + rem Handle different invocations: C:\Windows\system32\cmd.exe , cmd.exe , cmd + for %%p in (!CmdPath! !CmdExeName! !CmdName!) do ( + if !ParentPath!==%%p set IsCmdParent=1 + ) + + rem Check if we're running in cmd.exe with /c switch and this script path as argument + if !IsCmdParent!==1 if %%k==/c if "!ParentScriptPath!"=="%ScriptPath%" set IsExternal=1 + ) + ) +) + +if !IsExternal!==1 ( + echo %~nx0 does not work when run from this process. If you're in PowerShell, please 'Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1' and try again. + exit 1 +) + +endlocal +:: End code from @beatcracker +@echo off +:: +:: RefreshEnv.cmd +:: +:: Batch file to read environment variables from registry and +:: set session variables to these values. +:: +:: With this batch file, there should be no need to reload command +:: environment every time you want environment changes to propagate + +::echo "RefreshEnv.cmd only works from cmd.exe, please install the Chocolatey Profile to take advantage of refreshenv from PowerShell" +echo | set /p dummy="Refreshing environment variables from registry for cmd.exe. Please wait..." + +goto main + +:: Set one environment variable from registry key +:SetFromReg + "%WinDir%\System32\Reg" QUERY "%~1" /v "%~2" > "%TEMP%\_envset.tmp" 2>NUL + for /f "usebackq skip=2 tokens=2,*" %%A IN ("%TEMP%\_envset.tmp") do ( + echo/set "%~3=%%B" + ) + goto :EOF + +:: Get a list of environment variables from registry +:GetRegEnv + "%WinDir%\System32\Reg" QUERY "%~1" > "%TEMP%\_envget.tmp" + for /f "usebackq skip=2" %%A IN ("%TEMP%\_envget.tmp") do ( + if /I not "%%~A"=="Path" ( + call :SetFromReg "%~1" "%%~A" "%%~A" + ) + ) + goto :EOF + +:main + echo/@echo off >"%TEMP%\_env.cmd" + + :: Slowly generating final file + call :GetRegEnv "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" >> "%TEMP%\_env.cmd" + call :GetRegEnv "HKCU\Environment">>"%TEMP%\_env.cmd" >> "%TEMP%\_env.cmd" + + :: Special handling for PATH - mix both User and System + call :SetFromReg "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" Path Path_HKLM >> "%TEMP%\_env.cmd" + call :SetFromReg "HKCU\Environment" Path Path_HKCU >> "%TEMP%\_env.cmd" + + :: Caution: do not insert space-chars before >> redirection sign + echo/set "Path=%%Path_HKLM%%;%%Path_HKCU%%" >> "%TEMP%\_env.cmd" + + :: Cleanup + del /f /q "%TEMP%\_envset.tmp" 2>nul + del /f /q "%TEMP%\_envget.tmp" 2>nul + + :: capture user / architecture + SET "OriginalUserName=%USERNAME%" + SET "OriginalArchitecture=%PROCESSOR_ARCHITECTURE%" + + :: Set these variables + call "%TEMP%\_env.cmd" + + :: Cleanup + del /f /q "%TEMP%\_env.cmd" 2>nul + + :: reset user / architecture + SET "USERNAME=%OriginalUserName%" + SET "PROCESSOR_ARCHITECTURE=%OriginalArchitecture%" + + echo | set /p dummy="Finished." + echo . diff --git a/code/modules/utils/chibiScoop.ps1 b/code/modules/utils/chibiScoop.ps1 index 5fc7353..1f7ef82 100644 --- a/code/modules/utils/chibiScoop.ps1 +++ b/code/modules/utils/chibiScoop.ps1 @@ -15,10 +15,11 @@ $urlDictionary = @{ "spotify" = "https://raw.githubusercontent.com/ScoopInstaller/Extras/master/bucket/spotify.json" "simplewall" = "https://raw.githubusercontent.com/ScoopInstaller/Extras/master/bucket/simplewall.json" "ungoogled-chromium" = "https://raw.githubusercontent.com/ScoopInstaller/Extras/master/bucket/ungoogled-chromium.json" - "brave" = "https://github.com/ScoopInstaller/Extras/blob/master/bucket/brave.json" + "brave" = "https://raw.githubusercontent.com/ScoopInstaller/Extras/master/bucket/brave.json" "qview" = "https://raw.githubusercontent.com/ScoopInstaller/Extras/master/bucket/qview.json" "sublime" = "https://raw.githubusercontent.com/ScoopInstaller/Extras/master/bucket/sublime-text.json" "flameshot" = "https://raw.githubusercontent.com/ScoopInstaller/Extras/master/bucket/flameshot.json" + "java" = "https://raw.githubusercontent.com/ScoopInstaller/Java/master/bucket/temurin-jdk.json" } # Check if the software name provided is valid in the dictionary From 5e6f89d808dd1e6816753e72aa15b32078f2813e Mon Sep 17 00:00:00 2001 From: SegoCode <35817798+SegoCode@users.noreply.github.com> Date: Mon, 12 Aug 2024 14:52:09 +0200 Subject: [PATCH 06/14] Update downloadcenter.bat --- code/modules/downloadcenter.bat | 130 ++++++++++++++++++++++++++++---- 1 file changed, 116 insertions(+), 14 deletions(-) diff --git a/code/modules/downloadcenter.bat b/code/modules/downloadcenter.bat index 55372ff..5d956fb 100644 --- a/code/modules/downloadcenter.bat +++ b/code/modules/downloadcenter.bat @@ -15,10 +15,10 @@ echo This tool utilizes Scoop repositories to fetch the latest echo versions of software. echo. echo If scoop are enabled it will install the software -echo using scoop. You can install scoop by typing "scoop" +echo using scoop. You can install scoop by typing "scoop" echo as input. If are disabled, it creates an installation echo folder on your desktop with the software files. For more -echo info type "help" +echo info type "help" call utils\RefreshEnv.cmd > nul 2>&1 @@ -42,17 +42,120 @@ if %errorlevel% == 0 ( echo. cd %~dp0 -echo [1] Librewolf = [ Launch ] -echo [2] VLC Media Player = [ Launch ] -echo [3] qview = [ Launch ] -echo [4] qBittorrent Enhanced = [ Launch ] -echo [5] telegram = [ Launch ] -echo [6] sublime-text = [ Launch ] -echo [7] simplewall = [ Launch ] -echo [8] flameshot = [ Launch ] -echo [9] Brave = [ Launch ] -echo [10] java = [ Launch ] -echo [11] Steam (Non-scoop) = [ Launch ] +powershell -Command "scoop which librewolf" >nul 2>&1 +if %ERRORLEVEL% == 0 ( + echo [1] Librewolf = [ Installed ] +) else ( + if "%scoopInstalled%"=="true" ( + echo [1] Librewolf = [ Install with scoop ] + ) else ( + echo [1] Librewolf = [ Download in desktop ] + ) +) + +powershell -Command "scoop which vlc" >nul 2>&1 +if %ERRORLEVEL% == 0 ( + echo [2] VLC Media Player = [ Installed ] +) else ( + if "%scoopInstalled%"=="true" ( + echo [2] VLC Media Player = [ Install with scoop ] + ) else ( + echo [2] VLC Media Player = [ Download in desktop ] + ) +) + +powershell -Command "scoop which qview" >nul 2>&1 +if %ERRORLEVEL% == 0 ( + echo [3] qview = [ Installed ] +) else ( + if "%scoopInstalled%"=="true" ( + echo [3] qview = [ Install with scoop ] + ) else ( + echo [3] qview = [ Download in desktop ] + ) +) + + +powershell -Command "scoop which qbittorrent" >nul 2>&1 +if %ERRORLEVEL% == 0 ( + echo [4] qBittorrent Enhanced = [ Installed ] +) else ( + if "%scoopInstalled%"=="true" ( + echo [4] qBittorrent Enhanced = [ Install with scoop ] + ) else ( + echo [4] qBittorrent Enhanced = [ Download in desktop ] + ) +) + +powershell -Command "scoop which telegram" >nul 2>&1 +if %ERRORLEVEL% == 0 ( + echo [5] telegram = [ Installed ] +) else ( + if "%scoopInstalled%"=="true" ( + echo [5] telegram = [ Install with scoop ] + ) else ( + echo [5] telegram = [ Download in desktop ] + ) +) + +powershell -Command "scoop which subl" >nul 2>&1 +if %ERRORLEVEL% == 0 ( + echo [6] sublime-text = [ Installed ] +) else ( + if "%scoopInstalled%"=="true" ( + echo [6] sublime-text = [ Install with scoop ] + ) else ( + echo [6] sublime-text = [ Download in desktop ] + ) +) + + +powershell -Command "scoop which simplewall" >nul 2>&1 +if %ERRORLEVEL% == 0 ( + echo [7] simplewall = [ Installed ] +) else ( + if "%scoopInstalled%"=="true" ( + echo [7] simplewall = [ Install with scoop ] + ) else ( + echo [7] simplewall = [ Download in desktop ] + ) +) + +powershell -Command "scoop which flameshot" >nul 2>&1 +if %ERRORLEVEL% == 0 ( + echo [8] flameshot = [ Installed ] +) else ( + if "%scoopInstalled%"=="true" ( + echo [8] flameshot = [ Install with scoop ] + ) else ( + echo [8] flameshot = [ Download in desktop ] + ) +) + + +powershell -Command "scoop which brave" >nul 2>&1 +if %ERRORLEVEL% == 0 ( + echo [9] Brave = [ Installed ] +) else ( + if "%scoopInstalled%"=="true" ( + echo [9] Brave = [ Install with scoop ] + ) else ( + echo [9] Brave = [ Download in desktop ] + ) +) + +powershell -Command "scoop which java" >nul 2>&1 +if %ERRORLEVEL% == 0 ( + echo [10] java = [ Installed ] +) else ( + if "%scoopInstalled%"=="true" ( + echo [10] java = [ Install with scoop ] + ) else ( + echo [10] java = [ Download in desktop ] + ) +) + +echo [11] Steam = [ Download in desktop ] echo. echo [0] Return to menu @@ -180,7 +283,6 @@ if /i "%N%"=="scoop" ( echo. echo Scoop and the software required for its operation installed, check the log before proceeding. - pause ) if /i "%N%"=="help" ( From be0188f0f0fe66ee6a738ad8df6a6fdda9631b49 Mon Sep 17 00:00:00 2001 From: SegoCode <35817798+SegoCode@users.noreply.github.com> Date: Mon, 12 Aug 2024 14:52:12 +0200 Subject: [PATCH 07/14] Delete appsmanager.ps1 --- code/modules/appsmanager.ps1 | 104 ----------------------------------- 1 file changed, 104 deletions(-) delete mode 100644 code/modules/appsmanager.ps1 diff --git a/code/modules/appsmanager.ps1 b/code/modules/appsmanager.ps1 deleted file mode 100644 index 13084fe..0000000 --- a/code/modules/appsmanager.ps1 +++ /dev/null @@ -1,104 +0,0 @@ -Add-Type -AssemblyName PresentationFramework -Add-Type -AssemblyName System.Windows.Forms - -# Define the GUI XML in a multi-line string -$xaml = @" - - - - - - - - - - - - - - - - - -