Created
July 15, 2011 06:58
-
-
Save teamaton/1084221 to your computer and use it in GitHub Desktop.
Zipping and copying a VS multi-file item template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:echo %~p0 | |
REM | |
REM retrieve the name of the last folder in the path | |
REM | |
SET mydir=%~p0 | |
SET mydir=%mydir:\= % | |
for %%a in (%mydir%) do set LastFolder=%%~nxa | |
:echo %LastFolder% | |
set zipexe="C:\Program Files\7-zip\7z.exe" | |
IF NOT EXIST %zipexe% ( | |
echo. | |
echo ERROR: The 7-zip exe could not be found at the above location. | |
goto :ERROR | |
) | |
del %LastFolder%.zip | |
call %zipexe% a %LastFolder%.zip *.cs *.vstemplate | |
REM | |
REM Destination folder is the VS custom item template folder | |
REM | |
set destination="%UserProfile%\My Documents\Visual Studio 2010\Templates\ItemTemplates\Visual C#\Code" | |
IF NOT EXIST %destination% ( | |
echo. | |
echo ERROR: The destination folder could not be found at the above location. | |
goto :ERROR | |
) | |
copy %LastFolder%.zip %destination% | |
echo. | |
echo Successfully copied %LastFolder%.zip to %destination%. | |
echo. | |
pause | |
goto :eof | |
:ERROR | |
echo. | |
echo # An error occurred - the template was not copied to the destination. # | |
echo. | |
pause | |
@echo on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment