You need a shell to interpret the command. See for example this post.
You need a shell to interpret the command. See for example this post.
J-P Nurmi
alex chpenst (30th July 2008)
This works fine, thanks a million!!
Qt Code:
QStringList arguments; arguments << "-c" << "who|cut -d' ' -f1|sort -u"; QProcess exec; exec.start("/bin/sh", arguments);To copy to clipboard, switch view to plain text mode
How could we adjust this code to windows command?
should we replace /bin/sh with win32 or something?
thanks
SunnySan
Hi,
use cmd.exe with /c
HTH, BerndQt Code:
QStringList arguments; arguments << "/c dir /b e:\\test\\*.txt | sort"; QProcess exec; exec.start("cmd.exe", arguments); exec.waitForFinished(); qDebug() << exec.readAllStandardOutput();To copy to clipboard, switch view to plain text mode
Bookmarks