4

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"

255.tar.xz
  • 700
  • 7
  • 23

5 Answers5

0

The use of start is useless if VSCode is in the environment variables.

You can use code C:\Users\%username%\Desktop\File.c for exemple.If it doesn't work, I advise you to use a vbs script instead

You also don't need to run VSCode as an administrator unless you need to edit a file in a protected folder.

Sir Mishaa
  • 541
  • 1
  • 6
  • 19
0

Maybe not the exact answer to the question, but...

To start Visual-Studio-Code from CMD into the current folder write:

code %cd%

The environment variable cd tell VS-Code to open it with the current folder

MichiBack
  • 1,310
  • 13
  • 12
0

just open a cmd terminal and type code followed by return keyborad key.

JGaber
  • 37
  • 3
-1

Just open a cmd terminal and type code followed by a .

JGaber
  • 37
  • 3
  • just open a cmd terminal, go to your working directory and type code followed by a point : `code .` – JGaber Apr 09 '23 at 18:33
-2

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.
255.tar.xz
  • 700
  • 7
  • 23