Reputation: 487
In Windows Explorer, I can right-click on a file and choose Edit (or other system actions/verbs) instead of Open. Is it possible to do this from a cmd file? I want to mimic right-clicking on a file and choosing Edit, i.e. the file should open in the program configured to handle the Edit verb.
Upvotes: 1
Views: 210
Reputation: 11367
PowerShell "(New-Object -com 'Shell.Application').ShellExecute('file.txt', '', '', 'edit')"
Set Shell = CreateObject("Shell.Application")
Shell.ShellExecute "file.txt", "", "", "edit"
See the ShellExecute (Link) function.
Upvotes: 1