bat for 命令讲执行结果返回给变量
bat 执行结果赋值命令
for /f "delims=" %%i in ('dir ') do set b=%%i
- 直接讲dir 命令修改为任何需要执行的命令
`@echo off
echo %path%>tmp
set b=
::set TMP_STR=('findstr "CAT" tmp')
for /f "delims=" %%i in ('findstr "CAT" tmp') do (
set b=%%i
)
if "%b%" == "" (
echo "aaaaaaaaaaaaaa"
) else (
echo "abb"
)`
本文来自博客园,作者:ljymoonlight,转载请注明原文链接:https://www.cnblogs.com/ljymoonlight/p/15390209.html
posted on 2021-10-10 18:43 ljymoonlight 阅读(1035) 评论(0) 编辑 收藏 举报