Skip to main content

PowerShell

echo $PROFILE
ls (Split-Path $PROFILE)

ls Env:
Get-ChildItem Env:


Get-Alias
ls alias:
Get-Alias -Definition Get-ChildItem

Set-Alias -Name grep -Value Select-String

# 可能 PWSH 和桌面的 Session 不一样
# Session 0 通常是服务、后台进程、非交互进程
(Get-Process -Id $PID).SessionId
# 桌面的 Session
# Session 1+ 通常是用户桌面登录会话,比如 console/RDP
query user
aliasfor
?Where-Object
%ForEach-Object
acAdd-Content
catGet-Content
cdSet-Location
chdirSet-Location
clcClear-Content
clearClear-Host
clhyClear-History
cliClear-Item
clpClear-ItemProperty
clsClear-Host
clvClear-Variable
cnsnConnect-PSSession
compareCompare-Object
copyCopy-Item
cpCopy-Item
cpiCopy-Item
cppCopy-ItemProperty
cvpaConvert-Path
dbpDisable-PSBreakpoint
delRemove-Item
diffCompare-Object
dirGet-ChildItem
dnsnDisconnect-PSSession
ebpEnable-PSBreakpoint
echoWrite-Output
epalExport-Alias
epcsvExport-Csv
eraseRemove-Item
etsnEnter-PSSession
exsnExit-PSSession
fcFormat-Custom
fhxFormat-Hex
flFormat-List
foreachForEach-Object
ftFormat-Table
fwFormat-Wide
galGet-Alias
gbpGet-PSBreakpoint
gcGet-Content
gcbGet-Clipboard
gciGet-ChildItem
gcmGet-Command
gcsGet-PSCallStack
gdrGet-PSDrive
gerrGet-Error
ghyGet-History
giGet-Item
ginGet-ComputerInfo
gjbGet-Job
glGet-Location
gmGet-Member
gmoGet-Module
gpGet-ItemProperty
gpsGet-Process
gpvGet-ItemPropertyValue
groupGroup-Object
gsnGet-PSSession
gsvGet-Service
gtzGet-TimeZone
guGet-Unique
gvGet-Variable
hGet-History
historyGet-History
icmInvoke-Command
iexInvoke-Expression
ihyInvoke-History
iiInvoke-Item
ipalImport-Alias
ipcsvImport-Csv
ipmoImport-Module
irmInvoke-RestMethod
iwrInvoke-WebRequest
killStop-Process
lsGet-ChildItem
manhelp
mdmkdir
measureMeasure-Object
miMove-Item
mountNew-PSDrive
moveMove-Item
mpMove-ItemProperty
mvMove-Item
nalNew-Alias
ndrNew-PSDrive
niNew-Item
nmoNew-Module
nsnNew-PSSession
nvNew-Variable
ogvOut-GridView
ohOut-Host
popdPop-Location
psGet-Process
pushdPush-Location
pwdGet-Location
rInvoke-History
rbpRemove-PSBreakpoint
rcjbReceive-Job
rcsnReceive-PSSession
rdRemove-Item
rdrRemove-PSDrive
renRename-Item
riRemove-Item
rjbRemove-Job
rmRemove-Item
rmdirRemove-Item
rmoRemove-Module
rniRename-Item
rnpRename-ItemProperty
rpRemove-ItemProperty
rsnRemove-PSSession
rvRemove-Variable
rvpaResolve-Path
sajbStart-Job
salSet-Alias
sapsStart-Process
sasvStart-Service
sbpSet-PSBreakpoint
scbSet-Clipboard
selectSelect-Object
setSet-Variable
shcmShow-Command
siSet-Item
slSet-Location
sleepStart-Sleep
slsSelect-String
sortSort-Object
spSet-ItemProperty
spjbStop-Job
sppsStop-Process
spsvStop-Service
startStart-Process
stzSet-TimeZone
svSet-Variable
teeTee-Object
typeGet-Content
whereWhere-Object
wjbWait-Job
writeWrite-Output