简体   繁体   English

如何从命令提示符下运行VSCode

[英]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" codestart 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: 做这个:

  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 ) 快捷方式( .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. 打开您选择的命令行( PowershellCmd ),然后输入快捷方式的确切文件路径,例如: "C:\\Users\\Standard\\Desktop/VSCODE.lnk"然后按go键,实际上非常简单,只需找到代码即可.exe文件路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从带有参数的命令提示符下运行应用程序? - How to run application from command prompt with arguments? 在新命令提示符下从命令提示符运行别名命令 - Run alias command from command prompt in new command prompt 从桌面快捷方式运行命令提示符命令 - Run a Command Prompt command from Desktop Shortcut PowerShell:如何从PowerShell以管理员身份运行远程命令提示符命令? - PowerShell : How to run remote command prompt commands as admin from PowerShell? 如何在Windows机器上从命令提示符运行PHP程序? - How to run a PHP program from command prompt on a Windows Machine? 如何在 Windows 中的命令提示符启动时运行命令 - How to run a command on command prompt startup in Windows 如何在命令提示符下无限循环运行命令? - How to run a command in an infinite loop in command prompt? 如何在Windows命令提示符下运行此命令 - How to run this command in windows command prompt 上下文菜单中的“以管理员身份运行”不提示输入密码,如何从命令提示符下输入密码 - “Run as Administrator” in context menu doesn't prompt for password, how do I do that from command prompt 从命令提示符运行控制台应用程序 - Run console application from the command prompt
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM