Background:
We can use a combination of PATHEXT and the Windows file associations to do the Command Prompt equivalent of right-clicking a file in Explorer and clicking Open, e.g.:
C:\code\python> echo print "Hello, StackOverflow!" >hello.py
C:\code\python> hello
Hello, StackOverflow!
Similarly, I could use this to launch Photoshop by typing:
C:\art\source> StackOverflowLogo.PDF
The Actual Problem:
I need the command prompt equivalent of right-clicking the file in Explorer and selecting Edit instead.
With my hello(.py) above, that would likely bring up Python's Idle editor. However, I need a universal solution that uses the OS-level association for the file type. I can't assume it.
The simplest possible example of what I'd like to do would be this hypothetical EDIT.BAT file, which would do nothing but launch the editor for the given filename:
@InsertMagic /Here %1
Thanks! (I hope.)
Aaand... the solution:
Alex K. suggests Powershell, which is of course a great solution. So to write my EDIT.BAT above, I could do this:
@powershell -command "start -verb edit '%1'"
(That's slightly naïve, since there are potential quoting issues, but you get the idea.)
Cheers for the speedy answer. :)