批处理中如何判断变量中包含指定字符

来源:百度知道 编辑:UC知道 时间:2024/05/24 15:26:25
我用FOR来获得3个变量 %%a %%b %%c ,现在要判断%%c中是否包含“exe”,if 包含“exe”dosomething else dosomething

批处理的要要如何写呢?

我是接你的写的:
echo %%c|find "exe">nul&&set baohan_exe=true
if "%baohan_exe%"=="true" (
dosomething
) else (
dosomething
)

for /f "Delims=" %%i in ('dir /b *.*')do (
if %%~xi==exe echo 包含“exe”||echo 不包含“exe”)

@echo off
for /f "delims=exe" %%i in ("dksexe") do if %%i=="" (echo 不
包括exe) else (echo 包括exe)