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?
Best Answer
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"
incmd.exe
.You can even put this in a shortcut with
doskey
like this:Now you can do
cmdedit textfile.txt
on thecmd.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
.Edit:
This
.reg
file does it all for you: