标题:
[其他]
批处理如何检测空字符串
[打印本页]
作者:
netdzb
时间:
2020-9-19 15:02
标题:
批处理如何检测空字符串
echo ""
echo "weiqi"
echo "video"
echo "music"
如何加判断条件检测出空字符串?
作者:
Batcher
时间:
2020-9-20 08:39
回复
1#
netdzb
set "str=BAT"
if "x%str%" equ "x" (
echo 空
) else (
echo 非空
)
复制代码
作者:
netdzb
时间:
2020-9-20 08:58
回复
2#
Batcher
这样的代码怎么实现?
linux的shell是这样的
str=`ffmpeg -version|grep 'version'`
怎么把这个翻译成bat的代码?
作者:
Batcher
时间:
2020-9-20 09:07
回复
3#
netdzb
Linux建议用 $(xxx) 代替 `xxx`
Windows可以用 for 命令,参考:
http://bbs.bathome.net/thread-2187-1-1.html#pid12597
作者:
netdzb
时间:
2020-9-20 09:45
回复
4#
Batcher
谢谢,一会我去试一下。
欢迎光临 批处理之家 (http://bbs.bathome.net/)
Powered by Discuz! 7.2