I'm trying to open a file in it's default editor after the user has created the file. So far my script is:
@echo off @echo --- Create A New File --- @echo - @echo Where should we put the new file? set /p fileLocation=@ %UserProfile%\ @echo - @echo What do you want to call your new file? set /p fileName=@ @echo - @echo Almost Done! What is the files extension? set /p extension=@ . @echo - copy NUL "%UserProfile%\%fileLocation%\%fileName%.%extension%"
(ignore the extra echos and '@' those are just for fun)
After I click the file, it does the command: Choose Location > Choose File Name > Choose File extension
. I'm almost done on what I want but theres one last thing. How can I get the file name that I created and then open in its default text-editor?
Tap on the Windows-key, type cmd.exe and select the result to open the Command Prompt. Type control /name Microsoft. DefaultPrograms /page pageDefaultProgram to open the "Set your default programs" Control Panel window.
To open a file in a different application:From the desktop, right-click the desired file. From the drop-down menu, click Open with, then select the desired application. In this example, we'll select Paint. The file will open in the selected application.
You can use start
to open the file with the associated application.
Resources :
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With