Kaseya Community

Reference a variable inside a variable

  • A hopefully simple problem. (I've renamed things to keep it generic and on focus of the core fault)

    #agenttemp# as a pretty standard is the old kaseya install directory (C:\temp).

    I want to get a file content in a "get variable". Thus #agenttemp#\file.txt This gets output to my variable name 'name'. (#name#)

    This results in a fail in that step.

    However, if I change the text entry line in file content to C:\temp\file.txt it works perfectly.

    I know the #agenttemp# is setup correctly as I refer to it elsewhere in the scripting.

    I'm hoping this is a really easy fault of RTFM or similar. I would prefer to use the variable #agenttemp# of course (even though everything is in c:\temp. But you never know what will happen in the future).

    Cheers

    Dave

    Legacy Forum Name: Reference a variable inside a variable,
    Legacy Posted By Username: DaveChilli
  • Sounds like a typo somewhere.

    Try #vAgentConfiguration.agentTempDir#\file.txt instead of the variable you created for the temp folder.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: SMason
  • hmmm. No luck.

    Not only double checked spelling, but did it in the way I can be certain I know I got it right. (I copy/pasted the temp name and added #'s either side. As it works when I replace the variable with c:\temp I know I get the 2nd part right).

    Thanks for help so far.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: DaveChilli
  • And resolved. I had a space in there... *sigh*

    Amazing what happens when you just go "Stuff it. I'll type it again even though I know it won't work". .... "Wait. What? It works?"

    Thanks people..

    You were right SMason.. (Typo).. Stick out tongue

    Dave

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: DaveChilli