Nicolas
Nicolas

Reputation: 6504

How to open the Run window programmatically

Everyone knows the Run window that you can open with the shortcut Windows+R or directly in the Windows menu then Run.
I'm wondering how to open this Run window programmatically.
This window seems to be part of explorer.exe.
Does anyone have an idea on it ?

Upvotes: 5

Views: 1354

Answers (5)

CJBS
CJBS

Reputation: 15685

In PowerShell:

(New-Object -ComObject "Shell.Application").FileRun()

This does have the effect of flashing the PowerShell window for a moment, however

Or alternatively with

explorer "shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}"

Upvotes: 0

user15566053
user15566053

Reputation: 121

FYI, in Windows 10/11 (havn't checked 8.x) you can open the Run dialog easily by calling:

explorer shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}

E.g. in a batch script:

start explorer shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}

... and in pwsh with quotes:

explorer "shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}"

Upvotes: 2

CJBS
CJBS

Reputation: 15685

Using Windows Command (cmd.exe):

cmd /c 'explorer.exe Shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}'

Upvotes: 0

MrJackV
MrJackV

Reputation: 557

If you mean that it could open say at 8:00 am, then you can use autohotkey and simply write SendInput {Raw}{Lwin}{R} and then compile it as an .exe and put it as a cron job

Upvotes: 1

Roman Ryltsov
Roman Ryltsov

Reputation: 69706

You can use IShellDispatch::FileRun to achieve this.

See Using the Windows RunFile dialog - The documented and undocumented way for details and sample code.

Upvotes: 4

Related Questions