开发者

WMIC command lind issues when run from Java

开发者 https://www.devze.com 2023-01-17 05:25 出处:网络
Curr开发者_运维问答ently I have an applet that runs some command line commands. The applet will not work on random computers. The commands that seem to be causing issue are WMIC commands. The applet i

Curr开发者_运维问答ently I have an applet that runs some command line commands. The applet will not work on random computers. The commands that seem to be causing issue are WMIC commands. The applet is signed and works on some computers but simply hangs in others(even with the same OS and Browser version). I'v done a significant amount of testing and the only command that is causing issue is the WMIC command. Is this a know issue? Is there a work around for this?


I had the same issue when I tried to execute a subprocess.Popen command of WMIC in Jython.

Finally found a simple resolution here: http://community.flexerasoftware.com/showthread.php?t=189108&page=2

and merely added at the end of WMIC command the " < NUL " redirection

For example, Uninstalling program in Windows (using wildcard name):

import os
uninstallCommand = '%windir%\\system32\\wbem\\wmic product where "name like \'%My Program%\'" call uninstall /nointeractive < NUL'
os.system(uninstallCommand)
0

精彩评论

暂无评论...
验证码 换一张
取 消