-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels