PowerShell
The scripting language for Windows
Install
https://github.com/PowerShell/PowerShell#get-powershell
Commands
Check Windows status
see popup about activation
slmgr.vbs -xpr
see Windows version information
winver
Remove folder
This is the fastest way to remove a folder:
remove-item -force [file or folder]
Set environment variable
Similar to export
command in Bash
$env:NODE_OPTIONS='--openssl-legacy-provider'
Define commands
e.g. set location shortcut:
function cdhome {
set-location "c:/workspace/home"
}
cdhome
Output
Write-Output "Hello World!"
Reserve network ports
netsh interface ipv4 show excludedportrange protocol=tcp
reserve port 5432
net stop winnat
netsh int ipv4 add excludedportrange tcp startport=5432 numberofports=1 store=persistent
net start winnat
Web requests
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-restmethod
Invoke-RestMethod -Uri https://blogs.msdn.microsoft.com/powershell/feed/ |
Format-Table -Property Title, pubDate