6

I am creating a Windows Service in Visual Studio. On a post build event, I'd like to have 2 files created in the bin directory called install.bat and uninstall.bat. These files should have the name of the output EXE with a /u or /i in them. The name of the EXE should be dynamically written to the file, not hard coded. Is this possible?

Wagner DosAnjos
  • 6,304
  • 1
  • 15
  • 29
Sandy
  • 1,284
  • 2
  • 14
  • 32

1 Answers1

7

Open the project properties, go to 'Build Events', click 'Edit Post-build ...' and make use of the provided 'Macros>>' to get the msbuild properties you're after. Something like this:

echo $(TargetFileName) /a > $(TargetDir)install.bat
stijn
  • 34,664
  • 13
  • 111
  • 163