Skip to content

Instantly share code, notes, and snippets.

@toagit
Created June 16, 2015 04:00
Show Gist options
  • Save toagit/8e5cbd42ca6e4bd96aed to your computer and use it in GitHub Desktop.
Save toagit/8e5cbd42ca6e4bd96aed to your computer and use it in GitHub Desktop.
変数内の文字列を検索するコマンドのサンプル
echo off
set hoge="aaatestxxx"
@echo %hoge% | find "test" > NUL
echo %errorlevel%
if errorlevel 1 (
echo error!!
) else (
echo OK!
)
@echo %hoge% | find "xtesta" > NUL
echo %errorlevel%
if errorlevel 1 (
echo error!!
) else (
echo OK!
)
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment