新建文件
當(dāng)前目錄新建文件
new-item FILENAME.xxx -type file
當(dāng)前目錄新建文件夾
new-item DIRECTORYNAME -type directory
在指定目錄新建
new-item TARGETDIR FILENAME.xxx -type file
重命名文件
這個重命名命令把 C:/Scripts/Test.txt 重命名為 C:/Scripts/New_Name.txt:
Rename-Item c:/scripts/Test.txt new_name.txt
移動文件
Move-Item c:\scripts\test.zip c:\testX
使用正則
Move-Item c:\scripts\*.zip c:\test
Powershell 輸出中文亂碼解決方法
打開控制面板 -> Change date,time,or number -> 打開 “Region” 對話框
選擇 Administrative 選項(xiàng)卡,點(diǎn)擊 change system locale
選擇 Chinese(Simplified,China)確認(rèn)后,重啟電腦,即可。