繁体   English   中英

我想将以下命令的输出存储在批处理文件中的变量中

[英]i want to store the output of the below command in a variable in batch file

我想将以下命令的输出存储在批处理文件中的变量中

wmic product where name="%INPUT%" 调用卸载

在输出是否匹配 No Instance(s) Available 之后。 那么我想显示您的输入是错误的请检查您的输入

如果条件失败我想显示您选择的产品已成功卸载

这是你想要的?

for /f "delims=" %%i in ('wmic product where name="%INPUT%" call uninstall') do set output=%%i
if "%output%"=="No Instance(s) Available." (
 echo Your input is incorrect
 goto :skip
)
echo The product you selected was successfully uninstalled
:skip
pause

没有测试过,因为我不在我的电脑前。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM