次の方法で共有


Windows productivity tip #2: File Explorer -> VS Code at the current directory

I recently blogged a favourite shortcut of mine to get to the command prompt from Windows File Explorer command bar: https://blogs.msdn.microsoft.com/jamiedalton/2017/08/03/windows-productivity-tip-file-explorer-command-prompt-and-back-from-the-current-directory/

This is so ingrained in my day-to-day workflow, I wanted to extend this to another heavily used application, VS Code.

VS Code comes with a neat trick already, when at the command prompt, you can open VS Code to the current folder by using:

 c:\grandparent\parent\child\code .

But if you,re in Windows the quickest way to do this is the right-click context menu - Open with Code.  But by creating a simple batch file called "code.bat" and dropping it into the C:\windows\system32 directory you can get the above cmd in the Explorer bar trick to invoke VS Code at the current Windows File Explorer directory ie:

[video width="772" height="474" mp4="https://msdnshared.blob.core.windows.net/media/2017/08/VS-Code-shortcut.mp4"][/video]

code.bat (x32 version)

 @echo off
start "" "%ProgramFiles(x86)%\Microsoft VS Code\code.exe" .

code.bat (x64 version)

 @echo off
start "" "%ProgramFiles%\Microsoft VS Code\code.exe" .

Comments

  • Anonymous
    October 25, 2017
    Cheers Jamie!