poershell常用命令
时间: 2023-12-22 13:04:28 浏览: 31
以下是一些常用的PowerShell命令:
1. 获取当前目录:
```powershell
Get-Location
```
2. 切换目录:
```powershell
Set-Location <目录路径>
```
3. 列出目录中的文件和文件夹:
```powershell
Get-ChildItem
```
4. 创建新文件夹:
```powershell
New-Item -ItemType Directory -Name <文件夹名称>
```
5. 创建新文件:
```powershell
New-Item -ItemType File -Name <文件名称>
```
6. 复制文件或文件夹:
```powershell
Copy-Item -Path <源路径> -Destination <目标路径>
```
7. 移动文件或文件夹:
```powershell
Move-Item -Path <源路径> -Destination <目标路径>
```
8. 删除文件或文件夹:
```powershell
Remove-Item -Path <路径> -Recurse
```
9. 显示文件内容:
```powershell
Get-Content <文件路径>
```
10. 运行脚本文件:
```powershell
.\<脚本文件名>.ps1
```
11. 列出正在运行的进程:
```powershell
Get-Process
```
12. 结束进程:
```powershell
Stop-Process -Name <进程名称>
```
13. 安装模块:
```powershell
Install-Module -Name <模块名称>
```
14. 导入模块:
```powershell
Import-Module -Name <模块名称>
```
15. 查找特定文件:
```powershell
Get-ChildItem -Path <目录路径> -Filter <文件名关键字>
```
这些是一些常用的PowerShell命令,可以帮助你在命令行中进行文件和目录操作、进程管理等。如果你有其他具体的需求,请告诉我。