【笔记】PowerShell的Cmdlet

前言

Cmdlets are specialized commands in the PowerShell environment that implement specific functions. These are the native commands in the PowerShell stack. Cmdlets follow a Verb-Noun naming pattern, such as Get-ChildItem, which makes it self-documenting code. Cmdlets output their results as objects and can also receive objects as input, making them suitable for use as recipients in a pipeline. If a cmdlet outputs multiple objects, each object in the collection is passed down through the entire pipeline before the next object is processed.(维基百科

查看所有内置的Cmdlet

1
Get-Command

查看所有Cmdlet的别名

1
Get-Alias

查看指定Cmdlet的别名

1
Get-Alias <Cmdlet>

更新帮助文档

1
Update-Help

查看指定Cmdlet的帮助文档

1
Get-Help <Cmdlet>

清屏

1
clear

查看当前目录路径

1
Get-Location
1
pwd

切换当前目录路径

1
Set-Location
1
cd

拷贝文件

1
Copy-Item
1
copy
1
cp

移动文件

1
Move-Item
1
move
1
mv

查看当前目录文件

1
ls

查看文件内容

1
cat <file>

创建目录

1
mkdir <dir>

删除目录

1
rmdir <dir>

创建文件

1
touch <file>

删除文件

1
rm <file>

输出为csv文件

1
Export-Csv -Path <file>

输出为HTML文件

1
ConvertTo-Html > <file>

查看进程

1
ps

完成

参考文献