Skip to content

Instantly share code, notes, and snippets.

@karronoli
Created January 21, 2012 02:52
Show Gist options
  • Save karronoli/1650964 to your computer and use it in GitHub Desktop.
Save karronoli/1650964 to your computer and use it in GitHub Desktop.
command prompt test. escap & redirect to stdin
@rem call cmd.exe /v:on /c "cmd.exe /c c.bat & echo HOGE_!ERRORLEVEL!"
@rem return HOGE_255(stdout)
find /V "THIS_STRING_IS_NO_USE_IN_BAT" <%~0 >redirect.bat & cmd.exe /v:on /c "redirect.bat >%~n0.log 2>&1" & set REDIRECT=!ERRORLEVEL! & del redirect.bat & exit /b !REDIRECT!
set TEST_ENV=1
echo hoge
echo redirect %TEST_ENV% 1>&3
if () UNEXPECTED_EXIT
sleep 1
exit /b 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment