Table of Contents |
---|
...
http://steve-jansen.github.io/guides/windows-batch-scripting/index.html
If Statement Examples:
...
IF, no ELSE
No Format |
---|
if exist %SystemRoot%\system32\Macromed\Flash\flash.ocx %SystemRoot%\system32\Macromed\Flash\UninstFl.exe -q -u %SystemRoot%\system32\Macromed\Flash\flash.ocx
if exist %SystemRoot%\system32\Macromed\Flash\flash6.ocx %SystemRoot%\system32\Macromed\Flash\UninstFl.exe -q -u %SystemRoot%\system32\Macromed\Flash\flash6.ocx |
IF, ELSE
No Format |
---|
If Exist C:\Windows\SysWOW64 ( do some stuff for 64-bit Windows do maybe another line of stuff ) ELSE ( do some other stuff for 32-bit Windows and maybe another line of stuff ) |
IF, ELSE, GOTO
No Format |
---|
If Exist C:\Windows\SysWOW64 ( GOTO x64 ) ELSE ( GOTO x86 ) :x64 do some stuff GOTO END :x86 do some stuff GOTO END :END |
...
Initialize-Disk -Number 0 -PartitionStyle GPT
Getting System Info
Detecting Windows Version
CMD:
ver | find "6.3" >nul && goto WIN8
...
Get-WindowsEdition -Verbose -Online
Detecting Hardware Model
if /i "%WMICModel:~0,7%"=="20074DU" set TP=y
...