windows 批处理:在特定程序中打开特定文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10132381/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Batch: Open a specific file in a specific program?
提问by Lassa
How do i tell windows to open C:\test\test.txt in WordPad, when Notepad is my default program for .txt files?
当记事本是 .txt 文件的默认程序时,我如何告诉 Windows 在写字板中打开 C:\test\test.txt?
采纳答案by corn3lius
You can add the direct path to the executable like
您可以将直接路径添加到可执行文件,如
start C:\Windows\System32\write.exe [FILE]
回答by musefan
The accepted answer didn't work for me. I am not sure if it was because of the program I was trying to run, or because the path had spaces in (even though I wrapped it in quotes), or something else.
接受的答案对我不起作用。我不确定是因为我试图运行的程序,还是因为路径中有空格(即使我用引号将其包裹起来),还是其他原因。
Anyway, I was able to do it be adding an empty string after the start
command.
无论如何,我能够通过在start
命令后添加一个空字符串来做到这一点。
For example:
例如:
start "" "C:\My Programs\myprogram.exe" "C:\My Files\myfile.txt"
回答by Kirk Woll
Try:
尝试:
start wordpad c:\test\test.txt
回答by double-beep
There is no need to use start
when using write.exe
, so simply:
使用start
时不需要使用write.exe
,所以简单:
write [FILE(S)]
write.exe
is located in C:\Windows\System32
.
write.exe
位于C:\Windows\System32
.