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.
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Community Chosen Answer

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

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

Please log in to comment

Answers

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.

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.
Please log in to comment
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. 

Answered 05/23/2012 by: nshah
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity