Partager via


TIP: How to get rid of /the/really/long/file/path/that/shows/up/in/searchresults

Quick tips to make you more efficient in Visual Studio

Customizing search output in Visual Studio

When you do a Find in Files (CTRL+SHIFT+F), by default the output displays the file path which can fill up the results window.

Did you know you can use a registry key to customize the output of your search?

Create a string value in the registry called "Find result format"

  • HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\Find for Visual Studio 2013
  • HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\Find for Visual Studio 2012
  • HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Find for Visual Studio 2010

Here are the different values you can specify for the registry string. I like to use a string value of $f$e($l,$c):$t\r\n

  • $f is the filename
  • $e is the extension
  • $l is the line
  • $c is the column
  • $t is the text on the line
  • \n      newline 
  • \r carriage return

The end result? Simpler search results (as long as you don't need the file path)

 

If you liked this tip, check out the series Visual Studio Time Savers, where I share my favourite time saving tips. Give them a try and let me know what you think or your own! There are more coming, so make sure to check back often or subscribe to the RSS feed to get tips as soon as they are posted.

If one of these has helped you become more productive, make sure to comment on and share the videos.

Have a tip that has made you more productive? Let us know by tweeting to @cdndevs (hashtag #vstips) or commenting on the Microsoft Developer Facebook wall.

Comments

  • Anonymous
    December 02, 2014
    Is there a way to do this with Visual Studio Express (2013)?  The 'Find' folder does not appear under the registry entry (in fact most of those folders in the video don't).

  • Anonymous
    December 02, 2014
    @Schoon - I honestly don't know if there is a way to do it with the Express versions, maybe see if you can locate where in the registry Visual Studio is registered and if there is a Find Folder within that path . You could search for VisualStudio in the registry editor e.g. HKEY_CURRENT_USERSoftwareMicrosoftVisualStudio12.0

  • Anonymous
    December 02, 2014
    Wow, thanks for the quick reply.  I might have actually just found it, I'm going to try this registry location and see if it works: HKEY_CURRENT_USERSoftwareMicrosoftWDExpress12.0

  • Anonymous
    December 02, 2014
    Please let us know if it works!

  • Anonymous
    December 02, 2014
    @Susan - Yup, that was the registry path, it works now.

  • Anonymous
    December 04, 2014
    Awesome! Glad it works, and now I know how to do it in VS Express too!