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 instead of ".\a.exe":
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".
Procedure. Select Start > All Programs > Windows PowerShell version > Windows PowerShell. Type Set-ExecutionPolicy RemoteSigned to set the policy to RemoteSigned. Type Set-ExecutionPolicy Unrestricted to set the policy to Unrestricted.
Open a PowerShell console session, type exit , and press the Enter key. The PowerShell console will immediately close. This keyword can also exit a script rather than the console session.
The default execution policy for Windows 10. You can't run any PowerShell scripts and PowerShell is set to interactive mode so that you can only run individual commands. Default for server installs. You can run downloaded PowerShell scripts, but they must be signed by a trusted publisher.
PowerShell does not allow external script execution by default. The ExecutionPolicy setting in PowerShell prevents execution of external scripts by default in all versions of Windows. In some Windows versions, the default doesn't allow script execution at all.
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+";."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With