Kaseya Community

Execute File in Directory Path

  • OK - how does this statement work - I am stumped ...

    I want to execute a batch file inside of a specific directory so I do the following ...

    Step 1
    Get Directory Path from Registry - Which gets presumably the directory path I want from a registry key and this path will be used in all following steps according to what I read ...

    Step 2
    Execute File in Directory Path - this kind of works as it starts the script but it appears to start it in C:\Windows\System32 despite the registry key contains something else from Step 1 ... This then says the script worked, but in reality it did not work as the batch file cannot find the files to run that are being called from itself as it's looking in C:\Windows\System32 and not the directory from Step 1 ...

    Any Ideas anyone? I do have a workaround to make the script work, but I'd prefer to be able to script it in Kaseya without making changes to the batch file to change to the proper directory and then just running the batch file.

    Legacy Forum Name: Execute File in Directory Path,
    Legacy Posted By Username: TBK Consulting
  • Whenever calling batch files, make sure that batch file as all absolute path names for everything it is calling. This should prevent any issues with the batch file not finding what it needs.

    I've never used the "Get directory path from registry" when writing scripts. I always use "execute file", and either provide a static path to the executable, or using the "Get variable" function to get the installation path for an executable, then use that variable (whatever I chose to call it) when calling the executable.

    Hope this helps.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: Lmhansen
  • That was my workaround for the time being yes - however would like to know why this particular feature isn't working or how it is supposed to be used ...

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: TBK Consulting