cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
scottd72
Level 7

How to rename setup.exe from Postbuild Event

I'm trying to simply rename setup.exe from the Postbuild Event. I specify the following command, but nothing happens: REN "\DiskImages\Disk1\setup.exe" "\DiskImages\Disk1\TestSetup.exe"

How do you rename the setup.exe from Postbuild Events?
Labels (1)
0 Kudos
(2) Replies
MichaelU
Level 12 Flexeran
Level 12 Flexeran

I'm not sure this is the right way to handle such a rename, given that there are options to select the name in the product/release configuration already. That said, the problem is REN is a built-in command understood by cmd.exe, but it's not an actual executable. You can tell the difference with the where command:
C:\>where ren
INFO: Could not find files for the given pattern(s).

C:\>where xcopy
C:\Windows\System32\xcopy.exe
Unfortunately move is also a built-in command, so you might have to try something like cmd /c "ren from-name to-name".
0 Kudos
scottd72
Level 7

Thanks for the reply. For each product configuration I have a few different releases. Some releases I want to have setup.exe, others I want to have something different, so having a way to rename the setup.exe file after the build is necessary in my case.

The rename function does not work in my testing. What does work is doing two steps: cmd /c copy "\setup.exe" "\NewName.exe", then deleting the original: cmd /c del "\setup.exe"

Also, I want to distribute the exe after build. I found that the "Distribute After Build" function takes place after the Postbuild Event. So, I needed to do my copy and del on the file at it's destination folder. And yes, I suppose I could and should just have my PostBuild Event do it all in one copy command. But doing that would eliminate your ability to just right click on the release and perform a quick "Distribute."
0 Kudos