Skip to content

Instantly share code, notes, and snippets.

@Voronenko
Created March 12, 2014 16:07
Show Gist options
  • Save Voronenko/9510072 to your computer and use it in GitHub Desktop.
Save Voronenko/9510072 to your computer and use it in GitHub Desktop.
This example copies Vagrantfile and fixes relative path in target file
@echo off
setlocal enabledelayedexpansion
set INTEXTFILE=.kitchen\kitchen-vagrant\default-precise32-vsdev\Vagrantfile
set OUTTEXTFILE=Vagrantfile
set SEARCHTEXT=../../../
set REPLACETEXT=
set OUTPUTLINE=
for /f "tokens=1,* delims=¶" %%A in ( '"type %INTEXTFILE%"') do (
SET string=%%A
SET modified=!string:%SEARCHTEXT%=%REPLACETEXT%!
echo !modified! >> %OUTTEXTFILE%
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment