0

I have a batch file with this code:

@echo off
set VAR=7
echo the version is %VAR%

I want to add this .bat file to my visual studio project, using pre-build event. I wrote in the pre build event the path to the batch file, but then when I enter the : Resources ->PreProcessor definitions - I can't see the VAR How can I add it? any help would be appreciated!!

user1386966
  • 3,302
  • 13
  • 43
  • 72
  • This doesn't work, unless you run everything from the batch file. When settings environment variables, this only affects the local process and doesn't change the global settings. – Bo Persson Dec 09 '12 at 18:42

1 Answers1

1

Change your BAT script to be something like

echo #define VER 7 > version.h

and then have your code use

#include "version.h"
brian beuning
  • 2,836
  • 18
  • 22