PowerShell Onelineners that I use a lot
Current Script location:
often we have other files accompanying our script, so we should be able to find out the folder where my script is running from:
If ($myInvocation.MyCommand.Path -eq $Null) { $scriptRoot = $pwd.toString() } else { $scriptRoot = Split-Path (Resolve-Path $myInvocation.MyCommand.Path) }
This will set the $scriptRoot variable to either the current working directory (PowerShell interactive) or the folder where the script is running (PowerShell script running).
64bit ?
switch ([intptr]::size) {
4 { $Arch = "x86" }
8 { $Arch = "x64" }
default { $Arch = "x64" }
}
this will set the $Arch variable.
Geen opmerkingen:
Een reactie posten