Newer
Older
Import / applications / Photoframe / sh.bat
@John Ryland John Ryland on 10 Jan 2021 1 KB move to using the shell scripts
@echo off

rem Process the file given on the command line
setlocal enabledelayedexpansion
for /f "tokens=1,*" %%a in ('type %1') do (
set cmd=%%a
set line=%%b
call :_!cmd! !line!
)

goto:_slash_convert_end
:_slash_convert
SET ARGS=
:loop
if not "%1"=="" (
  SET Z=%1
  SET Z=!Z:$=%%!
  SET Z=!Z:{=!
  SET Z=!Z:}=%%!
  SET ARGS=%ARGS%!Z:/=\! 
  shift
  goto :loop
)
rem echo.%CD%^> %ARGS%
call %ARGS%
goto:eof
:_slash_convert_end

goto:cp_end
:_cp
call:_slash_convert copy %* && goto:eof
:cp_end

goto:cd_end
:_cd
call:_slash_convert cd %* && goto:eof
:cd_end

goto:sh_end
:_sh
call:_slash_convert sh.bat %* && goto:eof
:sh_end

goto:mkdir_end
:_mkdir
if "%1"=="-p" shift
SET Z=%1
SET Z=!Z:$=%%!
SET Z=!Z:{=!
SET Z=!Z:}=%%!
SET ARG=!Z:/=\!
if not exist %ARG% mkdir %ARG%
goto:eof
:mkdir_end

goto:rm_end
:_rm
setlocal
if "%1"=="-r" SET SARG=/S && shift
if "%1"=="-f" SET FARG=/F && shift
if "%1"=="-rf" SET SARG=/S && SET FARG=/F && shift
if not "%1"=="" (
SET Z=%1
SET Z=!Z:$=%%!
SET Z=!Z:{=!
SET Z=!Z:}=%%!
SET ARG=!Z:/=\!
)
rem echo del /Q %SARG% %FARG% %ARG%
if exist %1\ rmdir /Q %SARG% %ARG%
if exist %1  del /Q %SARG% %FARG% %ARG%
endlocal
goto:eof
:rm_end

goto:echo_end
:_echo
echo.%* && goto:eof
:echo_end

goto:export_end
:_export
SET F1=%*
rem echo SET !F1:/=\!
SET !F1:/=\!
goto:eof
:export_end

goto:make_end
:_make
call:_slash_convert %MAKE% %* && goto:eof
:make_end

goto:generic_end
:_unzip
:_qmake
:_lupdate
:_lrelease
call:_slash_convert %cmd% %* && goto:eof
:generic_end

rem Null commands
:_#
:_#/bin/bash
:_#!/bin/bash
rem goto:eof