Overview of PowerShell

Commands

New-Item

type nul > launch.json
New-Item [-ItemType "itemtype"][-Path "path"][-Name "filename"][-Value "This is a text string."][-Force]
New-Item -ItemType File -Path . -Name "testfile1.txt" -Value "This is a text string."`
New-Item -ItemType Directory -Path ./nuget -Force

Get-Location & Set-Location

# the automatic variable in powershell v3+ 
$PSScriptRoot

Install-WindowsFeature

Install-WindowsFeature -ConfigurationFilePath C:\DeploymentConfigTemplate.xml

Get-ExecutionPolicy & Set-ExecutionPolicy

#Run PowerShell as an administrator. (shift + PowerShell)
get-executionpolicy
set-executionpolicy remotesigned
.\build.ps1

Comparison Operators

parameter Equality
-eq equals
-ne not equals
-gt greater than
-ge greater than or equal
-lt less than
-le less than or equal

Demo

New-Item -ItemType Directory -Force -Path ./nuget
dotnet tool install --tool-path tools SignClient

$cd = Get-Location
Write-Output $cd

# storage
""
"###########################################"
"######### IdentityServer4.Storage #########"
"###########################################"
""
set-location ./src/Storage

你可能感兴趣的:(Overview of PowerShell)