I'm using Windows 11 and I'm trying to figure out a way to run a command-line program that needs specific commands as input. I want to create a shortcut to a .bat file that should let me launch this program while keeping the command prompt window open. The goal is to enter commands like you would normally do, without needing to type the executable's name every time. The program I'm working with is a patched version of the Speechify Tom TTS engine, and I need to input arguments directly (like the text to convert and the output file name) each time I launch it. Just to clarify, the .bat file and the .exe file are in the same folder, so I don't think I need to change directories. I'm looking for a solution to keep the command window open after the program initiates without it closing automatically due to lack of input.
4 Answers
Just a heads up, avoid using the `pause` command in your script if you want the .bat to run without interruptions. It can make the script halt until you press a key, which might not be what you want in every case.
It might help to check the program’s path when launching it from the .bat file. If it's closing unexpectedly, make sure your batch script is correctly locating the .exe file. You may want to specify the full path in the command if you're still running into issues.
To keep the command prompt window open after running your program, add a line with `pause` at the end of your batch file. This way, the window will wait for you to press any key before it closes, allowing you to see any output or messages that the program generates. If you prefer not to have a blank window open while the program runs, you might try using `start your_program.exe` instead. This will launch the program in a new window and let your batch file continue running without interruption.
I think you might need to adjust your batch file setup. If you want to receive input without typing the executable name every time, consider using `set /p` to prompt for the necessary inputs. It would look something like this: `set /p "text=Enter your text: "` followed by `set /p "filename=Enter filename: "` for the filename. Then you can call your program using these variables. This way, you can input text directly without repeating the executable name.
This is exactly the kind of setup I needed! Appreciate it!

But don't you also need to include the text and filename as arguments when you run it?