TheBobPony / MSEdgeTweaker

Easily configure Microsoft Edge, the way you want it!
http://fixedge.today/
289 stars 11 forks source link

No need for PowerShell inside cmd #13

Open niutech opened 4 months ago

niutech commented 4 months ago

You don't need to invoke yet another shell inside shell - PowerShell inside cmd. You can check Windows version:

for /f "tokens=4 delims=. " %%i in ('ver') do set VERSION=%%i

instead of:

%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile "If ($([System.Environment]::OSVersion.Version.Major) -GE '10') { Exit 0 } Else { Exit 1 }"

Next, you cna check if Windows is a part of domain:

for /f "tokens=2 delims==" %a in ('wmic computersystem get PartOfDomain /value') do set ComMem=%a

instead of:

for /f %%a in ('powershell "(Get-WmiObject -Class Win32_ComputerSystem).PartOfDomain"') do set ComMem=%%a

Also you don't need @ before setlocal since the first line is @echo off.

TheBobPony commented 4 months ago

Thank you very much for your feedback for the alternative method! I've been bit busy with other things, but I'll include your changes in the next revision!