/build/static/layout/Breadcrumb_cap_w.png

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.

(Pic Unrelated)

 


0 Comments   [ + ] Show comments

Answers (3)

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.
Posted by: snissen 11 years ago
Fourth Degree Green Belt
3

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:

http://ss64.com/nt/syntax-args.html

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

Posted by: philologist 11 years ago
Red Belt
1

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.


Comments:
  • PS. There may not be electricity. To properly prepare for the Zombie Apocalypse, go here: http://www.cdc.gov/phpr/zombies.htm. - philologist 11 years ago
  • 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. - muebel 11 years ago
Posted by: nshah 11 years ago
Red Belt
0

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. 

Don't be a Stranger!

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

Sign up! or login

Share

 
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