Batch file trouble
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开发者_如何学Python 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
%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
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.
精彩评论