Whenever I need to run a powershell script it complains of security, if I add powershell.exe -nologo -executionpolicy bypass -File .\install.ps1
I still get permission denied unauthorizedAccessException. I just want to run this install script, what is the sudo equivalent to type on the powershell on windows?
Windows Powershell doesn't have sudo - some commands need to be run as an administrator and Powershell has no concept of that.
There is no sudo command in Windows. The nearest equivalent is "run as administrator." You can do this using the runas command with an administrator trust-level, or by right-clicking the program in the UI and choosing "run as administrator." runas is elevation of a user account in Administrators; sudo is another thing.
gsudo is a sudo equivalent for Windows, with a similar user-experience as the original *nix sudo. It allows to run commands with elevated permissions, or to elevate the current shell, in the current console window or a new one. Just prepend gsudo (or the sudo alias) to your command and it will run elevated.
The Windows PowerShell prompt opens by default at the root of your user folder. Change to the root of C:\ by entering cd c:\ inside the Windows PowerShell prompt.
If you are using Chocolatey (a package manager), you can install a package named sudo
.
Then you can use sudo like Linux 😋
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