Em qua 02 abr 2014, às 12:18:59, Jason Kretzer escreveu: > powershellHDD.start("PowerShell -Command \"&{(Get-WmiObject > Win32_LogicalDisk -Filter \\\"DeviceID='C:’\\\").Size}\"");
> This does not work as I expect it to. The dataHDDsize is an empty string > “”. If I pull the command out and run it directly from a command prompt > (removing the escaping backslashes) it runs exactly as I expect it to > returning a number. I thought maybe the number is the problem and I have > similar commands that return proper letters and the same thing occurs. > > Style and suggestions for third party libs aside, does any one have any > pointers? There's a comment in qprocess.cpp that reads: // handle quoting. tokens can be surrounded by double quotes // "hello world". three consecutive double quotes represent // the quote character itself. I don't know whose idea it was to use three quotes successively to indicate a quote character. It doesn't work on a regular Unix shell: $ echo """hello""" hello Nor on Windows's prompt: C:\>echo """hello""" """hello""" That commit has been there since the Qt public history started. It's even documented as such (I had to look it up, I didn't know): http://qt-project.org/doc/qt-5/qprocess.html#start-3 But I don't know why it was done like that. It's highly surprising. If it weren't documented, I'd be tempted to just change behaviour and go for standard backslashing. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest