"sudo su" equivalent in windows - cmd

I've seen multiple questions on this topic and some answers about runas but none of them was sufficient...
I need a Windows command to upgrade privileges of a terminal after it has already been opened with permissions of an average user. ie. To upgrade permissions for the whole terminal session and not just to run one command as administrator! Something just like sudo su in Linux.
If anyone knows any trick to do this that would be much appreciated.
Edit:
Why I need this? I use the terminal in Visual Studio Code; it wouldn't let me run commands that require administrative permissions. It sucks to have to open an external terminal to do this... And currently, the only way I'm aware of to run a terminal in VS code in elevated permissions would be by editing the Code.exe's compatibility settings to run as administrator. But that adds more trouble because now it shows the user account control prompt every time I run an instance of VS Code.
Also creating a special shortcut to run VS Code in administrative mode wouldn't help because I run it from the context menu (Open With Code) so I don't have to manually navigate to the project folder.

There is no such an equivalent in Windows.
What you might do is to open your desired process from cmd with:
runas /user:administrator processname.
or open any application with right-click and run as..

Related

Sudo on windows

Hey I ran into the error of BSOD 0xc000021a and I already found some solutions using the „emergency commandline“ at X:/Windows when running into recovery Options.
Sadly it is constantly disallowing me to use Commands Bc of Not enough permissions. I know the Password and got a Windows shell but not the option to Right click for executing as admin.
Any help is deeply needed. Thank you in advance!
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."

How to access Anaconda in PowerShell after reinstallation?

Anaconda was installed by Systems Team on my work computer.
For reasons beyond this topic, they installed in Program Files, which I think is non-optimal.
So I ask permission to remove the installation and reinstall it via standard procedures.
When I open Anaconda PowerShell prompt it is still pointing to the Program Files installation which I have removed.
I have also checked the Path environmental variable, and there is nothing looking like Anaconda is still there.
How can I get Anaconda PowerShell prompt to work again?
It should be noted that conda command does work in regular command prompt.
Thanks.
Initialize conda for use with Powershell via
conda init powershell
This command should be run in Anaconda Prompt.
Before following #Peter's solution, I was able to track the problem via a more rustic procedure.
Right click on Start Menu's Anaconda PowerShell Prompt, and select Open File Location.
Right click on the icon's Properties, select Shortcut tab > Target field.
Copy the command to a text editor, and noticed it was still using an old location.
Changing the command to point to the right location did fix the problem.
... but that is only the command from the Start Menu, the rest is done by what was suggested before.
Thanks for the help.

Have WSL shell open to project directory in Windows Visual Studio Code

I have a windows subsystem for Linux Installed on my computer and am using it as the integrated terminal on Visual Studio Code. Every time I open a terminal however, it opens in the root directory rather than the current project directory like other terminals do.
Does anyone know of a fix for this?
I have tried messing with the Cwd of the integrated terminal settings but haven't had any luck.
Try using wsl.exe as the command for shell.
"terminal.integrated.shell.windows": "wsl.exe"
I know that is very late for this answer, but for me it just worked.
I put exactly as above and it launched in my home directory (that is /mnt/d/Users/Adrian).
I have the user setup of VSC, 1.30.1 and launch it from the Desktop shortcut.
After I configured terminal as wsl I go as below:
If I open a cmd windows I can launch it with code . it will launch in Windows home directory.
If move to some other folder (e.g Documents) and launch it with code . the bash will launch to that folder.
Otherwise I can launch it with code D:\Users\Adrian\Documents\VSC and the bash terminal will launch in \mnt\D\Users\Adrian\Documents\VSC
Tested the change both via menu File->Preferences->Settings and with Ctrl+Shift+P (Command Pallete), Terminal: Default Shell.
Tried with bash and wsl.
Maybe you have some other bash installed in the path? (e.g. git bash or MinGW bash?)

Have tried all traditional troubleshooting: "Can't find script engine "VBScript" for script..."

I've done all the traditional fixes in every major threads related to this problem and I still get this error. I'm trying to run a .vbs to install a webdisk onto my computer. (Please note that I'm not a programmer so I'm hoping to receive help in Layman's terms.)
I've gone into registry and fixed the HKEY to list the .dll.
I've deleted all cleaners and adblockers and anti-virus programs.
I've created a new .reg that merged threads.
Please help. I'm going crazy up here at the lake.
Cheers.
Please follow the following steps:
Open command prompt as Administrator using Run As Administrator
Now type sfc /scannow and press enter.
Check the message that you get and take the corresponding action as mentioned here.
You can also try doing the following:
Run regsvr32 vbscript.dll and regsvr32 jscript.dll in command prompt as administrator.
Also run the Windows Cleanup Utility as Administrator.
This should fix your issue.

ActiveMQ install issue

I am running win7 professional 64-bit. I have already installed java, and am trying to install ActiveMQ. The install worked perfectly on a Windows Server 2003 machine but now it is giving me issues on my win7 machine. I download ActiveMQ 5.3.2 extract the files and then try to run the installservice.bat file as administrator and it gives me the following error in command prompt: '"wrapper.exe"' is not recognized as an internal or external command, operable program or batch file.
I had the same issue when using Windows Explorer and right clicking on the InstallService.bat file and selecting "Run As Administrator".
However, this worked for me (without having to change my user control settings):
1) Open a command prompt (right clicking first with "run as administrator").
2) Then navigate to the folder where your batch file is and simply type InstallService.bat.
Ok I feel a little stupid answering my own question but here it goes. Turn off the user control settings in the control panel
I had the same issue with apache-activemq-5.6.0 and solved it this way:
Open cmd.exe as admin (click on Start, type in cmd, right click on the "cmd" program, and choose Run as administrator)
In the cmd.exe window, navigate to your apache-activemq-5.X.X root dir (which contains bin, conf, data, docs, ...)
From there, navigate to bin\win64
Your commmand prompt should show something like:
...\apache-activemq-5.6.0\bin\win64>
Still in the cmd.exe, run InstellService.bat
It does not work if you run something like win64\InstellService.bat while being in bin. You have to actually navigate to bin\win64 first.
The in case you are installing in win 64 bit 2012 Server too, run InstallService.bat under sys32.
Its little confusing but it works.

Resources