If we want to open Windows Explorer and select a file, we can use the command
System.Diagnostics.Process.Start("explorer.exe", "/select," + @"c:\Folder\file.txt");
Is there a way to open Windows Explorer programmatically and show the results of a search? For example, as a user I can open Windows Explorer and fill in "*.txt" into search area to list all text files.
I got it working. It was in fact very simple. Assume I am searching for files with filename containing the term "mat" in folder "C:\temp1". The explorer window has the title "CustomSearch". It works in Windows 10.
string searchLink = "search-ms:displayname=CustomSearch&crumb=filename%3A*mat%20&crumb=location:C%3A%5Ctemp1";
Process.Start(searchLink);
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.