Skip to content

Instantly share code, notes, and snippets.

@pckujawa
Created August 10, 2012 19:16
Show Gist options
  • Save pckujawa/3317024 to your computer and use it in GitHub Desktop.
Save pckujawa/3317024 to your computer and use it in GitHub Desktop.
Windows batch script to copy a file to multiple output files if they don't already exist
@if "%1"=="" (
@echo Usage: %0 sourceFile file1 [file2 file3 ...]
goto :eof
)
@set sourceFile=%1
@shift
:parseparams
@if [%1] neq [] (
@if not exist %1 echo F | xcopy %sourceFile% %1 /F /-Y
REM If you don't want the prompts displayed onscreen, use the next line instead (but it won't show the paths of the files copied)
REM @if not exist %1 copy %sourceFile% %1 /-Y
@if %errorlevel% neq 0 pause
@shift
@goto parseparams
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment