Search code examples
windowscmdvisual-studio-codeadminrunas

How to run VSCode from the command prompt


I for security reasons cannot run VSCode plainly. I have opened it in the past, but now due to specific reasons, I may only run VSCode from the command prompt. I've tried

start "path/to/file" code and start code "path/to/file"
but none work I'm on Microsoft Windows [Version 10.0.17134.407]

how may I run this by going to Windows+R then 'cmd' then start/ run?

Also it would be great if I could use this for a separate user.

I'm looking for something like:
Runas /user:user\admin /savecred "C:\Program Files (x86)\vs-code.exe"


Solution

  • Well shoot, as it turns out that after doing some experimentation I found out that there's a way. Do this:

    1. Simply stick this:

      runas /user:Techtiger255\admin /savecred "C:\Users\Admin\AppData\Local\Programs\Microsoft VS Code\Code.exe"
      

      inside of a shortcut (.lnk file)

     

    1. Open your command line of choice (Powershell or Cmd) and enter the exact file path of your shortcut ex: "C:\Users\Standard\Desktop/VSCODE.lnk" and hit go, stupidly simple really, just had to find the code.exe file path.