[英]How to run VSCode from the command prompt
I for security reasons cannot run VSCode plainly. 出于安全原因,我不能简单地运行VSCode。 I have opened it in the past, but now due to specific reasons, I may only run VSCode from the command prompt. 我过去曾经打开过它,但是现在由于特定原因,我只能在命令提示符下运行VSCode。 I've tried 我试过了
start "path/to/file" code
and start code "path/to/file"
start "path/to/file" code
和start code "path/to/file"
but none work I'm on Microsoft Windows [Version 10.0.17134.407]
但我在Microsoft Windows [Version 10.0.17134.407]
上都无法使用Microsoft Windows [Version 10.0.17134.407]
how may I run this by going to Windows + R then 'cmd' then start/ run? 我该如何通过以下方法运行此程序:转到Windows + R,然后单击“ cmd”,然后启动/运行?
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"
The use of start is useless if VSCode is in the environment variables. 如果VSCode在环境变量中,则使用start无效。
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 例如,您可以使用code C:\\Users\\%username%\\Desktop\\File.c
如果它不起作用,建议您改用vbs脚本
You also don't need to run VSCode as an administrator unless you need to edit a file in a protected folder. 您也无需以管理员身份运行VSCode,除非您需要编辑受保护文件夹中的文件。
Well shoot, as it turns out that after doing some experimentation I found out that there's a way. 好吧,事实证明,经过一些试验,我发现有办法。 Do this: 做这个:
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
) 快捷方式( .lnk file
)内
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. 打开您选择的命令行( Powershell
或Cmd
),然后输入快捷方式的确切文件路径,例如: "C:\\Users\\Standard\\Desktop/VSCODE.lnk"
然后按go键,实际上非常简单,只需找到代码即可.exe文件路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.