10

I want to open a folder and automatically select a file from the command line:

>> explorer C:\Windows\system32\selected_file.txt

Once Windows Explorer has opened C:\Windows\system32 I want selected_file.txt to be highlighted automatically. Is that possible with Windows Command Prompt?

Thom
  • 591
  • 4
  • 12
  • 30

1 Answers1

13
explorer.exe /select,c:\windows\system32\selected_file.txt

See https://support.microsoft.com/en-us/kb/130510

Tony Hinkle
  • 4,706
  • 7
  • 23
  • 35
  • 5
    Is there a way to select the file without opening a new window? Let's say the folder is open and I want to select a file in the open folder. How would I do that using cmd? – akinuri Oct 23 '17 at 09:55
  • @akinuri: did you ever find out how to do what you have asked? What about the same for multiple files at once? – u01jmg3 Dec 08 '19 at 21:16
  • @u01jmg3 Nope. I created a [custom "New" submenu](https://superuser.com/questions/1242099/create-a-new-new-submenu-in-context-menu-with-a-custom-name) in the context menu, and wanted to be able to rename the file after its creation, you know, like the way Windows does. Kinda gave up on this "select" thing. I just do it manually. – akinuri Dec 09 '19 at 07:36