Jump to content
Sign in to follow this  
erebus

explorer.exe and AU3

Recommended Posts

erebus

Hello all,

I am trying to call explorer.exe to open a drive. Although I can use this command from the command line:

c:\windows\explorer.exe /root,c:

...which works just fine, when using the same command from AU3, explorer.exe fails:

Run(@WindowsDir & "\explorer.exe /root,c:", @WindowsDir)

The error message I get (from explorer.exe) is something like "Windows cannot find "root,c:"." Also it always opens My Documents folder this way (don't know why). Can somebody verify and explain this strange behaviour? Also, is there any other way to tell windows open a drive bypassing explorer.exe?

Thank you,

Share this post


Link to post
Share on other sites
erebus

Ok, problem solved.

The problem was that in the script I was killing explorer, before running it again using the above command. It seems like if you kill explorer.exe, Windows try to automatically rerun it, so if you try to run it in the middle of this process, explorer.exe fails.

I put a While...Wend loop and now runs fine.

I'm sorry for the false alarm.

P.S. However I can't understand why Windows rerun automatically explorer.exe when you kill it from AU3 while they don't if you kill it manually from Task Manager... If anybody can enlight me on this, I would be grateful.

Edited by erebus

Share this post


Link to post
Share on other sites
Ranmaru

Ok, problem solved.

The problem was that in the script I was killing explorer, before running it again using the above command. It seems like if you kill explorer.exe, Windows try to automatically rerun it, so if you try to run it in the middle of this process, explorer.exe fails.

I put a While...Wend loop and now runs fine.

I'm sorry for the false alarm.

P.S. However I can't understand why Windows rerun automatically explorer.exe when you kill it from AU3 while they don't if you kill it manually from Task Manager... If anybody can enlight me on this, I would be grateful.

Can't you just use the ShellExecute function for this?


Share this post


Link to post
Share on other sites
erebus

I suppose so... However this script is very old (much older than ShellExecute() itself :P) that's why I stuck with the above method. Thanks anyway.

P.S. However does anybody have a clue about this automatic rerun of explorer.exe? I suspect that it is caused because AutoIT calls it? Dunno...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×