简体   繁体   中英

Is there a way to set a keyboard shortcut to open containing folder of a selected file in Solution Explorer in Visual Studio?

When I click on a C++ project in Visual Studio, I get this menu:

在此处输入图像描述

And so I can quickly press Alt+F,F (Command ProjectandSolutionContextMenus.Project.OpenFolderinFileExplorer ) to open the folder of the project.

I also found that I can open containing folder if I open the file in the Text Editor in Visual Studio: 在此处输入图像描述

I bound it to Alt+F,F as well. I set it to only be active in Text Editor, it's the File.OpenContainingFolder command.

But when I click on files inside the project in the Solution Explorer, there is no context menu: 在此处输入图像描述

I tried to make the File.OpenContainingFolder command global, but it still doesn't work in the Solution Explorer when I just click on a file once. If I double click it and open it in the text editor, it works.

And I can't find a command in the Keyboard section in options of Visual Studio to open containing folder of a file selected in the Solution Explorer.

Maybe someone knows how to do it?

You can create an external tool menu item, and then bind a shortcut to that item.

  1. Go to Tools > External Tools .
  2. Click Add .
  3. In Title edit box type Show in Explorer .
  4. In Command edit box type explorer.exe .
  5. In Arguments edit box type /select, $(ItemPath) . There is a space between a comma and a dollar sign.
  6. Click OK .
  7. Make note at the position of the new command in the list. It could be first, it could be fifth, or something else. Let's assume it's the fifth one.
  8. Assign a shortcut to the command Tools.ExternalCommand5 . Restrict the shortcut to Solution Explorer.

That's it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM