Using the following
explorer.exe /select, "c:\path\to\file.txt"
I can open Windows Explorer and select the file. In Delphi I do this to select "Parm" file:
ShellExecute(Application.MainForm.Handle, 'OPEN', PChar('explorer.exe'), PChar('/select,"' + Parm + '"'), nil, SW_NORMAL);
And it works. My problem is this: if I select a different file in the recently opened Explorer (clicking in a different file) and then call the above code the "Parm" file is not selected again. Interestingly, there are some programs that select the file again. For instance, ITunes always selects the desired file.
Does anyone have a clue of how to make Explorer always select the specified file?
The most effective method to fix Windows Explorer not responding is to clear file explorer history. You can open on Control Panel, set view by large icons and click File Explorer Options from the interface. Then click Clear button and OK to clear Windows Explorer history. Then try opening Windows Explorer again.
A simple fix for File Explorer does not highlight selected files or folders problem would be toggling High Contrast mode on and off. In order to do so, press left Alt + left Shift + Print Screen; a pop-up will ask “Do you want to turn on high contrast mode?” select Yes.
Select Start > Settings > Update & Security . Select Recovery and under Advanced startup, select Restart now. You may need to select Windows 10 Advanced Startup. or that may happen automatically. On the Choose an option screen, select Troubleshoot > Advanced options > Startup Repair.
You may be using an outdated or corrupted video driver. System files on your PC may be corrupt or mismatched with other files. You may have a Virus or Malware infection on your PC. Some applications or services running on your PC may be causing Windows Explorer to stop working.
This is a known limitation of using the /select switch with explorer.exe, it will only select the specific file if the parent folder is not already open.
You'll have to use an API call like SHOpenFolderAndSelectItems in stead. This function also allows for multiselect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With