您现在的位置是:网站首页> 编程资料编程资料
PowerShell小技巧之使用Verb打开程序_PowerShell_
2023-05-26
326人已围观
简介 PowerShell小技巧之使用Verb打开程序_PowerShell_
假设你经常需要编辑自己的”hosts”文件,这时你也许会手动在记事本中打开它。这个文件只允管理员成员编辑,普通的实例还无法操作。
这段代码它能让你很容易调整权限打开所有程序。
function Show-HostsFile { $Path="$env:windir\system32\drivers\etc\hosts" Start-Process -FilePath notepad -ArgumentList $Path -Verb runas } 支持所有PS版本
您可能感兴趣的文章:
相关内容
- PowerShell小技巧之从函数中返回多个值_PowerShell_
- PowerShell小技巧之使用New-Module命令动态创建对象_PowerShell_
- PowerShell小技巧之使用Hotmail账号发送邮件_PowerShell_
- Powershell小技巧之设置IE代理_PowerShell_
- Powershell小技巧之找出最大最小值_PowerShell_
- Powershell小技巧之屏蔽输出结果_PowerShell_
- Powershell小技巧之删除不规则字符_PowerShell_
- Windows Powershell 复制数组_PowerShell_
- Windows Powershell 访问数组_PowerShell_
- PowerShell小技巧之同时使用可选强制参数_PowerShell_
