Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在ant目标中执行wmic命令_Ant_Wmic - Fatal编程技术网

在ant目标中执行wmic命令

在ant目标中执行wmic命令,ant,wmic,Ant,Wmic,如何使用任务在ant target中执行以下命令 wmic nic where 'netconnectionid like '%'' get netconnectionid 如果我在上面的命令行中运行,我可以得到以下输出: NetConnectionID Local Area Connection Local Area Connection 2 但是,如果我通过以下方式调用此命令: <target name="test"> <exec executable="wmi

如何使用任务在ant target中执行以下命令

wmic nic where 'netconnectionid like '%'' get netconnectionid
如果我在上面的命令行中运行,我可以得到以下输出:

NetConnectionID
Local Area Connection
Local Area Connection 2
但是,如果我通过以下方式调用此命令:

<target name="test">
    <exec executable="wmic">
    <arg line="nic where 'netconnectionid like '%'' get netconnectionid"/>
    </exec>
</target>
有人能帮我吗?
谢谢大家!

80041017是您的错误号。大于80040200的数字是组件特定错误和0x80040200下的常规OLE错误

WBEMDisp.h是这么说的

wbemErrInvalidQuery = 0x80041017
但是您的查询是针对所有内容的,所以您可以省略where allall

wmic nic get netconnectionid

使用exec任务和读取输出是否有帮助?对我来说,单引号看起来可疑。它们是否应该显示内部和外部引号?您可以将HTML实体用于双引号和&apos;对于单引号。这会有帮助吗?谢谢你@David W。你解决了我的问题!!!
wmic nic get netconnectionid