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

后端 未结 4 1475
余生分开走
余生分开走 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:34

    add in your path (evironment variable) the path where you usually put your script and exe file.

    0 讨论(0)
  • 2021-02-05 06:38

    run the command like so:

    C:\flutter\bin> .\flutter doctor
    
    0 讨论(0)
  • 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+";."
    
    0 讨论(0)
  • 2021-02-05 07:00

    Rename your script file so that it starts with a '.'.

    See https://github.com/PowerShell/PowerShell/issues/9468

    0 讨论(0)
提交回复
热议问题