在用户创建文件之后,我试图在其默认编辑器中打开一个文件.到目前为止,我的脚本是:
@H_502_1@@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%"
(忽略额外的回声和“@”那些只是为了好玩)
单击文件后,它将执行以下命令:选择位置>选择文件名>选择文件扩展名.我几乎完成了我想要的,但最后一件事.如何获取我创建的文件名,然后在其默认文本编辑器中打开?
您可以使用开始打开与关联的应用程序的文件.
资源:
> Open a File in the Default Application using the Windows Command Line (without JDIC)