如何使用cmd中的默认应用程序打开文件? [英] How to open file with default application in cmd?
本文介绍了如何使用cmd中的默认应用程序打开文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在用户创建文件后在默认编辑器中打开文件。到目前为止,我的脚本是:
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?
推荐答案
可以如何使用创建的文件名? c $ c>开始以使用关联的应用程序打开文件。
You can use start
to open the file with the associated application.
资源:
- Open a File in the Default Application using the Windows Command Line (without JDIC)
这篇关于如何使用cmd中的默认应用程序打开文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文