Appearance
基本用法
查看版本
$host
$PSVersionTable查看操作系统版本
systeminfo
[Environment]::OSVersion查看当前用户
whoami
$env:USERNAME查看当前路径
$PWD查看当前目录文件列表
Get-ChildItem操作
新建文件夹
New-Item -ItemType Directory -Path test进入文件夹
Set-Location test新建文件并输入内容
New-Item -ItemType File -Path a.txt
'Hello World' | Out-File a.txt
'Hello Human' | Out-File a.txt -Append
Get-Content a.txt
'Hello World' | Out-File b.txt
'Hello Human' | Out-File b.txt
Get-Content b.txt
Get-Content *.txt复制文件
Copy-Item a.txt c.txt移动文件
Move-Item b.txt d.txt查看文件数量
Get-ChildItem | Measure-Object删除文件、删除文件夹
Remove-Item a.txt
Set-Location ..
Remove-Item test -Recurse退出
exit