简体   繁体   中英

Execute Windows run dialog command in command prompt

In the Windows Run dialog, I can use the command shell:startup to open the user's startup folder.

In hope to be able to use the command in the Windows command line, I tried typing shell in the command prompt, but returned with the error message

'shell' is not recognized as an internal or external command,
operable program or batch file.

How can I execute such run line commands in the command prompt?

Use the start-command, like the following:

start shell:startup

You can also use start /? to display help of the start-command.

The run dialog accepts not only a command but also a URL/URI or any real paths, as you can see from its description:

运行对话框

That's why when you open shell:startup which is a special path (specified in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\FolderDescriptions ) it works normally

However in Windows cmd or PowerShell the command must be an executable file, a script file or any other files with a registered type. It won't accept a folder. To work around that use either of the following

start shell:startup
explorer shell:startup

If the path contains spaces then in cmd you must add another empty parameter due to the legacy issues in cmd.exe

start "" "shell:common startup"

If you use PowerShell then start "shell:common startup" will work normally because start is an alias to Start-Process in PowerShell. If you run explorer then you don't need that empty string either

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM