tags:

views:

43

answers:

2

Hello I want to make a batch file and i have made it as

set OLD_PATH=%CD%
set PATH=C:\bada\1.0.0b3\Tools\Toolchains\Win32\bin%path%C:\bada\1.0.0b3\Include
set CPLUS_INCLUDE_PATH=C:\bada\1.0.0b3\Include

call

g++ -I"C:/bada/1.0.0b3/include" -I -O0 -g3 -Wall -c -MMD -MP -MF"src/AnimationApp.d" -MT"src/AnimationApp.d" -o"src/AnimationAppEntry.o" "C:\Users\Suvin\Desktop\ezBADA\temp\src\AnimationApp.cpp

call

g++ -I"C:/bada/1.0.0b3/include" -I -O0 -g3 -Wall -c -MMD -MP -MF"src/AnimationAppEntry.d" -MT"src/AnimationAppEntry.d" -o"src/AnimationAppEntry.o" "C:\Users\Suvin\Desktop\ezBADA\temp\src\AnimationAppEntry.cpp

call

g++ -L"C:/bada/1.0.0b3/Model/Wave_LP1/Simulator" -L"C:/bada/1.0.0b3/Lib" -L"C:/bada/1.0.0b3/IDE/workspace2/AnimationApp/lib" -shared -o"AnimationApp.exe"  C:\Users\Suvin\Desktop\ezBADA\temp\src/AnimationApp.o C:\Users\Suvin\Desktop\ezBADA\temp\src/AnimationAppEntry.o -losp_rt0 -lFMedia -lFApp -lFUi -lFUiControls -lFBase -lFSystem -lFGraphics

But the paths and drives here are according to my computer.Now suppose a different user want to use my batch file he will have his SDK and src files placed on different drives.How to create a Batch file which takes the path of global drives according to different users.Also i want that in the process of making a batch file the remaining files should be deleted.Help would be greatly appreciated

A: 

%homedrive% is the drive your windows installation is on, %username% is the current user, %homepath% is the current users' home folder in documents and settings

MaQleod
Thanks but could you help how to use it..??
Suvin
with reference to the above batch file
Suvin
set CPLUS_INCLUDE_PATH=C:\bada\1.0.0b3\Include is the same as: set CPLUS_INCLUDE_PATH=%homedrive%\bada\1.0.0b3\Include, but will work on a computer if the drive windows was installed in is H: or E: or whatever.
MaQleod
but what if i have a folder ezbada.earlier this folder was placed on deaktop so my path was C:\Users\Suvin\Desktop\ezBADA.What if i want to continiously keep changing the folder location suppose this time oh E: drive.Then what should be putted in the path and also my SDK was in C: drive.That is why the path was C:\bada\1.0.0b3\Tools\Toolchains\.What if a diff user places his SDK somewhere else.What should we use at that time as it has nothing to do with windows.Thanks Maqleod. But please elobrate a bit further.
Suvin
You could use this for the desktop location: %userprofile%\desktop
MaQleod
but in the event that you will need to find out where the location of that install is every time, it would be easiest if that software left a registry marker where its installation directory is. I am not familiar with that software, so I don't know how best to direct you at this point, but I'll do a little research.
MaQleod
HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\bada SDK 1.0.0\(Default) contains the install directory for the system, you can check that in batch using reg query and parse for what you need.
MaQleod
MaQleod: `%userprofile%\desktop` is not necessarily the Desktop. The folder can be anywhere.
Joey
A: 

If you have no easy way of figuring out where stuff resides, I'd just use global environment variables for this:

if not defined OLD_PATH set OLD_PATH=%CD% 
if not defined CPLUS_INCLUDE_PATH set CPLUS_INCLUDE_PATH=C:\bada\1.0.0b3\Include

Well, and PATH is a different beast, still. You can then just set the environment variables once for the user and the batch file will use them if they are present or use its own defaults.

To delete the files that remain from the build, simply use del to delete them. del can also take wildcards, so

del *.obj

is ok too.

Ideally, however, you'd use a build automation tool here like make or MSBuild.

Joey