4

In Windows 7, I could launch a program like Notepad and pass it a command-line argument (the path and filename of a document to open) by typing:

Windows Keynotepad c:\users\jon\myfile.txtEnter

In Windows 8 and Windows 10, although either of the following work fine to launch Notepad:

Windows KeynotepadEnter (via the Start page / Metro UI)

Windows Key+SnotepadEnter (via the Search charm)

Adding a command-line argument as in the original example above does not work. It causes Windows to not find the program. (Windows 10 launches a web search for whatever I typed instead of running the program.)

So I have had to adjust my workflow in Windows 8/10 to (1) launch the application, and then (2) manually bring up a File Open dialog from within the application to load by document. It's annoying having to do in two separate steps what I used to be able to accomplish in Windows 7 with just one.

Running the application via Windows Key+R (the old Windows XP style Run dialog) with command line arguments works, but only for applications that are on the Path -- not for applications that Windows can find via its Search feature.

Is there any way to get my original example above working under Windows 8/10?

1

Probably, they fixed this in Windows 10 since the question was asked, but this works for me out of the box:

WIN, notepad test

The second entry in the result list allows to run the notepad application with the test command line argument. (The "Best match" first entry starts a search). So you then need to press Down and then Enter to run the command.

As soon as I type either a file extension or a path separator, the "run command" entry becomes the first "Best match" entry. So, after typing

WIN, notepad.exe test

WIN, notepad test.txt

WIN, notepad c:\

- I then only need to press Enter to run the notepad application with the command line arguments.

To allow a custom application to be run the same way, it can be added to the HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths registry key like the following (replace the values below with the needed values):

Add key someapp.exe with the following string values:

(Default) : C:\Path to app\someapp.exe

Path : C:\Path to app\

This is the same way which allows to run some custom application from the Windows Run (WIN+R) dialog, even if the application is not in the PATH environmental variable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.