Kaseya Community

Execute Shell Command Path?

  • Does anyone have the path where the "Execute Shell Command" option in KScripting runs from? I have a few executables that unfortunately reference local folders when running so I need to copy these to the path from which these commands are being executed. Thanks in advance for any help.

    Legacy Forum Name: Execute Shell Command Path?,
    Legacy Posted By Username: jviggiano
  • Well if someone knows that would be great, but I found a work around by running my executable from a batch file that as a cd command before it executes inside it and seems to have done the trick.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: jviggiano
  • I'm pretty sure "Execute Shell Command" is comparable to running %COMSPEC% or C:\Windows\System32\cmd.exe which means the command path is C:\Windows\System32\

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: SMason
  • I built a small script to do a "dir" of wherever the Execute Shell Command starts and it came up with C:\Windows\System32.

    Script Name: test
    Script Description:

    IF True
    THEN
    Get Variable
    Parameter 1 : 10
    Parameter 2 :
    Parameter 3 : tempPath
    OS Type : 0
    Execute Shell Command
    Parameter 1 : dir >> #tempPath#\test.txt
    Parameter 2 : 0
    OS Type : 0
    Get Variable
    Parameter 1 : 1
    Parameter 2 : #tempPath#\test.txt
    Parameter 3 : result
    OS Type : 0
    Write Script Log Entry
    Parameter 1 : #result#
    OS Type : 0
    ELSE



    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: CCDave
  • You can change where it is running from by using "cd" etc to move to the correct folder, then using the "&" to link commands. They will then run from that location.

    e.g

    cd c:\temp & myEXE.exe

    If you want to access another drive, you need to put another step in there e.g.

    cd d:\temp & d: & myEXE.exe

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