KACE Product Support Question

Retrieve Kace Dependency Dir during run-time of KScript?

05/23/2012 17664 views

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.

(Pic Unrelated)


Answer Summary:
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.
0 Comments   [ + ] Show comments


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

Answered 05/24/2012 by: snissen
Fourth Degree Green Belt

All Answers


The $(KACE_DEPENDENCY_DIR) is a system variable on the K1K; you can't access it with the batch file deployed to the system.  The way to do this is to log into the K1K as http://yourk1k/adminui rather than just admin.  This will allow you to see the full URLs for each page.  The unique number for each script, managed install, etc. will tell you what the number will be for the deployment folder, and you will be able to call out the correct dependency folder in your batch script.

Answered 05/23/2012 by: philologist
Red Belt

  • PS. There may not be electricity. To properly prepare for the Zombie Apocalypse, go here: http://www.cdc.gov/phpr/zombies.htm.
  • 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.

Under any script there is a Policy or Job Rules area. Next to that is a yellow box. Clicking on that will tell you the pathways each of the KBOX internal varilables use. As Philologist indicated, you will need to know the folder number the KBOX will create to point your batch file to the right location. 

Answered 05/23/2012 by: nshah
Red Belt

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ