Retrieve Kace Dependency Dir during run-time of KScript?
I have a offline kscript that runs a batch file. I know that I can use token replacement variables to generalize things like the $(KACE_DEPENDENCY_DIR), but what about inside a batch file that the kscript runs? Is there some convenient way of doing this?
Simply adding $(KACE_DEPENDENCY_DIR) to the batch script doesn't seem to work.
Hardcoding the dependency dir is how I ended up doing that, although it makes me a bit squeamish. It would be nice to be able to abstract it.
Community Chosen Answer
I handle this problem another way: in a few "Run a batch file" script steps, I pass "$(KACE_DEPENDENCY_DIR)" in as the first parameterin the script, then use it as %1 in the batch file itself.
But there's another way to get it: the full pathname of every batch file is available to the batch file as %0.
Using the %~ tricks documented here:
you can get just the drive and path parts of %0, or strip the quotes from %1.
For all batch file questions, I find that ss64.com site the very best reference. Sande