Open multiple instances of File Explorer

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
j2112
Posts: 2
Joined: 22 Jun 2021, 13:07

Open multiple instances of File Explorer

22 Jun 2021, 13:14

Hey guys, this should be easy, but I'm getting stuck on one part.
I want to open the file explorer twice with one ahk script.

Here is what I have:

Code: Select all

#a:: 
run C:\Users\Jason\Desktop\
Sleep 10
run C:\Users\Jason\Desktop\
return
This only opens one file explorer.
I can open another by right clicking on the FE window and clicking "desktop"

Anyway around this?

Thanks again and again
GosHotk
Posts: 7
Joined: 11 Jun 2021, 12:57

Re: Open multiple instances of File Explorer

22 Jun 2021, 14:23

Try this:

Code: Select all

RunWait, explorer C:\Users\Jason\Desktop

Run, explorer C:\Users\Jason\Desktop
User avatar
j2112
Posts: 2
Joined: 22 Jun 2021, 13:07

Re: Open multiple instances of File Explorer

22 Jun 2021, 14:54

Hey, this will get the job done for sure. Would this work on more than 2 windows?

My understanding is runwait holds the program, allows run to execute, then releases the runwait command so it does not detect the file explorer window as being open?

Nice work around if nothing else,
I appreciate it.
GosHotk
Posts: 7
Joined: 11 Jun 2021, 12:57

Re: Open multiple instances of File Explorer

22 Jun 2021, 15:39

j2112 wrote:
22 Jun 2021, 14:54
Hey, this will get the job done for sure. Would this work on more than 2 windows?

My understanding is runwait holds the program, allows run to execute, then releases the runwait command so it does not detect the file explorer window as being open?
I'm an AutoHotkey n00b, so maybe somebody more knowledgeable will weigh in. But it's my understanding that the RunWait essentially just means that AutoHotkey will wait until the first Explorer window is finished opening (not until it's eventually closed) before it moves to the next line. I'm not sure I understood your second paragraph, but the part about not detecting a window as being open sounded off to me.

And I'll let you run the trials, but I'd be surprised if you couldn't open three (or more) Explorer windows the same way. Just use RunWait for each instance other than the last.

As a final note, if you might be interested in opening those windows in particular places on your screen (e.g., side by side), you might want to check out this post:

https://www.autohotkey.com/boards/viewtopic.php?f=76&t=91722

CORRECTION: Having just checked this with Notepad (after reading a little more about it), it is my revised understanding that running most programs with RunWait will mean that the next line doesn't execute until the RunWait-ed program closes. But Explorer is an exception to that general rule.
Last edited by GosHotk on 22 Jun 2021, 17:04, edited 1 time in total.
Loop
Posts: 169
Joined: 07 Jan 2019, 14:51

Re: Open multiple instances of File Explorer

22 Jun 2021, 16:10

Code: Select all

run, % "explorer.exe  C:\Users\Jason\Desktop\"
Sleep, 10
run, % "explorer.exe C:\Users\Jason\Desktop\"

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doodles333, Frogrammer, Google [Bot] and 264 guests