P
P
Pavel Dmitriev2016-06-21 13:37:12
Qt
Pavel Dmitriev, 2016-06-21 13:37:12

Running a finished .bat file in QT Quick?

How to run a finished .bat file using a button in a QT Quick application under windows?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mercury13, 2016-06-21
@Mercury13

This is a system-dependent task, and in Qt this is only partially so. Under Windows, it works like this.
1. Get the path to COMMAND.COM by reading the COMSPEC environment variable. There is a QProcessEnvorinment class for this.
2. Run the program (CreateProcess or ShellExecute) with the command line "/c filename parameters". Qt has a QProcess object, I have not tested its performance.
3. If you also need to transfer the result of execution somewhere, deal with the I/O redirection of the CreateProcess function. QProcess probably has I/O redirection too.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question