Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The start command (in PowerShell an alias for Start-Process, in cmd.exe a shell builtin) does the same as the Windows Explorer context menu 'Open' action: it opens the file using the application which Windows has registered for it.

(Or are there perhaps small differences? Or perhaps it triggers the default action, which normally is the 'Open' action?)

How do I trigger the 'Edit' action for a file from the command line?

share|improve this question

The "Edit"-verb really does trigger the "Edit"-action.
(I tested it with changing the "Edit" for .reg files in the registry and running the command.)

Since you made your answer "a partial answer" did you want to know how you would do this in cmd.exe? I don't think it can be done natively in `cmd.exe'.

There is of course ShelExec.

But you can also run powershell -command "start -verb edit textfile.txt" in cmd.exe.

You can even put this in a shortcut with doskey like this:

doskey cmdedit=powershell -command "start -verb edit $1"

Now you can do cmdedit textfile.txt on the cmd.exe-prompt.

Note: for the doskey-'macro' to be available after restarting the computer/cmd-session you need to add this command in your startup-scripts. You can look here for some suggestions to making it permanent.
I would go for the option of putting it in
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun.


This .reg file does it all for you:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"AutoRun"="doskey cmdedit=powershell -command \"start -verb edit $1\""
share|improve this answer

(Partial answer which I discovered as I was typing the question.)

For PowerShell I discovered the following:

start -verb edit ...filename...

Documentation (from get-help start-process -full):

-Verb <string>
    Specifies a verb to be used when starting the process, such as Edit, Open, or Print.
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .