Problem with external Visual Studio tools

Visual studio 2005: I am transitioning from post build event to using external tool menu with batch file.

I used to have

cd "$(ProjectDir).."
for /f "tokens=2,3,4 delims=/ " %%a in ('date /t') do set bdate=%%c.%%a.%%b
pkzipc -add -overwrite -dir=current "Z:\Technology\VisualStudio2005\Project Zips\$(ProjectName)_%bdate%_%username%.zip" "$(ProjectDir)*"

      

When I try to use this as an external tool it wraps "around" the project name and adds an additional file \ to the SolutionDirectory (I'm not sure if I want the project or solution dir to continue and doesn't work)

The code I'm trying to use:

pkzipc -add -overwrite -dir=current Z:\Technology\VisualStudio2005\Project Zips\%2\%2_%bdate%_%username%.zip %1*

      

this code doesn't work, I think the first part, stripping the outer "", answers that it leaves extra \ at the end of the projectdir variable. How can I fix this?

+1


a source to share


4 answers


I ran with a specially crafted .NET app instead of the command line for this, as it was less complicated.



0


a source


I'm not sure I will follow you (and there is no direct question), but if you have a parameter surrounded by quotes and you want to remove it, you can use another variable:



set THEDIR=%1
set THEDIR=%THEDIR:"=%

      

+1


a source


You can also trim the last char like so:

SET SOMEVAR=%SOMEVAR:~0,-1%

      

If quotes and \ appear in the same variable, you can do this instead:

SET SOMEVAR=%SOMEVAR:~1,-2%

      

0


a source


You are probably installing the external tool incorrectly, you need to give the full path to pkzipc in the Command: field and put the arguments in the arguments :.
Also you don't have access to script parameters, so% 1% 2 won't work, you have to specify the following field:

-add -overwrite -dir=current "Z:\..\$(ProjectName)_%bdate%_%username%.zip" "$(ProjectDir)*"

      

0


a source







All Articles