|
Answer» I'm developing an APPLICATION and i need to SET a variable with the current path for that aplication (it can be anywhere in the computer) after that i have to invoke the application itself.
There is a way to set a variable with the current path for an aplication?
I have tried desperate combinations like these: CHDIR > SET APPLICATION_PATH SET APPLICATION_PATH | CHDIR :-/
I'm not experienced with bat programming so any help would be apreciated
Thanks in advance for any helpwhats wrong with the %CD% variable ?Not sure what you're looking for, but after deciding where your application lives, your batch file can set the path pointer:
Code: [Select]set path=c:\yourdirectory;%path% yourprogram
Some programs (you would know since your developing it ) need external components for the program to run, in which case this METHOD MAY be preferable:
Code: [Select]cd \yourdirectory yourprogram
Good luck. 8-)ikanriu,
I think what you want is:
%~dp0 - will resolve to the drive and path of the batch %~f0 - will resolve to the full QUALIFIED name of the batch
So that the following will set the APPLICATION_PATH variable to the path of the batch and then run the batch.
Code: [Select]SET APPLICATION_PATH=%~dp0 "%~f0"DOS IT HELP? Um....... how about this?
Code: [Select]SET CurrentDirectory=%cd% Replace "CurrentDirectory" with the variable name of your choice.
|