如何删除脚本和可执行文件前面带有“。\”的PowerShell要求?

时间:2012-03-20 18:38:38

标签: powershell

如何删除脚本和可执行文件前面带有“。\”?

的PowerShell要求

输入“a.exe”而不是“。\ a.exe”时显示的PowerShell警告消息:

The command a.exe was not found, but does exist in the current location. Windows PowerShell doesn't load commands from the current location by default. If you trust this command, instead type ".\a.exe".

4 个答案:

答案 0 :(得分:19)

这是一项安全功能,因此您可以运行您认为正在运行的脚本。这就是为什么与cmd不同,你在PATH中没有.(当前目录),你必须做.\my.exe等。

如果您不想这样做并破坏此预防措施,请将.添加到您的路径中:

$env:PATH =$env:PATH+";."

答案 1 :(得分:0)

path(环境变量)中添加您通常放置scriptexe文件的路径。

答案 2 :(得分:0)

重命名脚本文件,使其以“。”开头。

请参见https://github.com/PowerShell/PowerShell/issues/9468

答案 3 :(得分:-1)

像这样运行命令:

C:\flutter\bin> .\flutter doctor