wmic使用

来源:互联网 发布:2016中国人工智能大会 编辑:程序博客网 时间:2024/04/30 22:18

如果监测到某进程挂了就把该进程拉起来

wmic process where "(CommandLine LIKE '%D:\\OracleBI\\DAC com.siebel.etl.net.QServer%')" | findstr "QServer"  || startserver.bat


wmic process where "(ExecutablePath LIKE '%%D:\\Dac_servers\\EDW_DAC_01\\jre\\bin\\java.exe%%')" get executablepath | findstr "EDW_DAC_01"  || startserver.bat

wmic process where "(CommandLine LIKE '%E:\\OracleBI\\DAC com.siebel.etl.net.QServer%')" | findstr "QServer"  || echo hi


wmic process where "(CommandLine LIKE '%%com.siebel.etl.net.QServer%%')" delete


jps -l | findstr "QServer" ||call startserver.bat  --不能循环使用,jps没有wmic准确


cmd 组合命令和管道命令的使用 

|| 
Usage:第一条命令 || 第二条命令 [|| 第三条命令...] 
用这种方法可以同时执行多条命令,当碰到执行正确的命令后将不执行后面的命令,如果没有出现正确的
命令则一直执行完所有命令;



0 0
原创粉丝点击