How do you remove the PowerShell requirement that scripts and executables be preceded by “.\”?

后端 未结 4 1474
余生分开走
余生分开走 2021-02-05 06:02

How do you remove the PowerShell requirement that scripts and executables be preceded by \".\\\"?

The PowerShell warning message that is shown when \"a.exe\" is entered

4条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-05 06:58

    It is a security feature so that you do run scripts that you think you are running. That is why unlike cmd, you do not have . ( current directory) in PATH and you have to do .\my.exe etc.

    If you don't want to do this and subvert this precaution, add . to your PATH:

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

提交回复
热议问题