Open text file and program shortcut in a Windows batch file

后端 未结 12 1341
暗喜
暗喜 2020-12-13 17:59

I have two files in the same folder that I\'d like to run. One is a .txt file, and the other is the program shortcut to an .exe. I\'d like to make

相关标签:
12条回答
  • 2020-12-13 18:25

    The command start [filename] opened the file in my default text editor.

    This command also worked for opening a non-.txt file.

    0 讨论(0)
  • 2020-12-13 18:30

    Don't put quotes around the name of the file that you are trying to open; start "myfile.txt" opens a new command prompt with the title myfile.txt, while start myfile.txt opens myfile.txt in Notepad. There's no easy solution in the case where you want to start a console application with a space in its file name, but for other applications, start "" "my file.txt" works.

    0 讨论(0)
  • 2020-12-13 18:30

    I use

    @echo off
    Start notepad "filename.txt"
    exit
    

    to open the file.

    Another example is

    @echo off
    start chrome "filename.html"
    pause
    
    0 讨论(0)
  • 2020-12-13 18:30

    If you are trying to open an application such as Chrome or Microsoft Word use this:

    @echo off
    start "__App_Name__" "__App_Path__.exe"
    

    And repeat this for all of the applications you want to open.

    P.S.: This will open the applications you select at once so don't insert too many.

    0 讨论(0)
  • 2020-12-13 18:34

    You can also do:

    start notepad "C:\Users\kemp\INSTALL\Text1.txt"
    

    The C:\Users\kemp\Install\ is your PATH. The Text1.txt is the FILE.

    0 讨论(0)
  • 2020-12-13 18:34

    Its very simple, 1)Just go on directory where the file us stored 2)then enter command i.e. type filename.file_extention e.g type MyFile.tx

    0 讨论(0)
提交回复
热议问题