Last active
February 18, 2017 16:30
-
-
Save CallumWatkins/a8c583e6dd67fa472cc6b02640d275e3 to your computer and use it in GitHub Desktop.
Opens a Windows Explorer file/folder search for the specified query, with the option of a location. License: MIT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void SearchWindowsExplorer(string query, string location = null) | |
{ | |
if (location != null && !Directory.Exists(location)) | |
{ | |
throw new ArgumentException("Directory does not exist.", "location"); | |
} | |
string uri = "search:query=" + Uri.EscapeDataString(query) + | |
(location == null ? string.Empty : "&crumb=location:" + Uri.EscapeDataString(location)); | |
Process.Start(uri); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment