Skip to content

Instantly share code, notes, and snippets.

@christian-korneck
Created April 2, 2023 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christian-korneck/e33badc798fa4e1fa7b242d6ab5d64ea to your computer and use it in GitHub Desktop.
Save christian-korneck/e33badc798fa4e1fa7b242d6ab5d64ea to your computer and use it in GitHub Desktop.
batch file - execute the shell command received from stdin
@echo off
setlocal
REM batch script that executes the command that it received via STDIN
REM (whitespaces should be working)
for /f "tokens=*" %%i in ('find /v ""') do set MYCMD=%%i
cmd.exe /c %MYCMD%
set myerrorlevel=%errorlevel%
exit /B %myerrorlevel%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment