• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Need some command line magic

Merad

Platinum Member
I'm trying to set up a post build event in Visual Studio to zip the output of one of my installer projects. The issue is that the (Wix) installer project uses some tricks so that the output file is renamed to include the program version, but these tricks don't actually update the macros in VS, so I can't just directly invoke 7z in the build event.

What I'm trying to is run a batch file (or script directly from the build event) to do the renaming. It *should* be as simple as

Code:
for %a in (*.msi) do 7z a -tzip "%~na.zip" "%a"

...and when I run that directly from the command line, it works fine. But when I drop it in a batch file and try to run it, I get the error "~na.zip" "a" was unexpected at this time."

What am I missing?
 
In batch files you have to double-up on the "%"s.

Code:
for %%a in (*.msi) do 7z a -tzip "%%~na.zip" "%%a"
 
Back
Top