Jump to content

@scriptdir appears to return incorrect path


Recommended Posts

I have an AutoIT script that I am using as part of a software distribution task in LANDesk.

The script is started by another executable (sdclient.exe) when the machine starts. In the script I reference @scriptdir to get a path to where my script lives. The other resources the script needs live relative to that path.

The problem I have is when the script runs, @scriptdir seems to contain duplicate path information.

for example, normally I would expect it to contain something like:

C:\Program Files\LANDesk\LDClient\sdmcache\ldlogon\packages\softwarefiles\v7.6.1045\x86\

Instead, it contains

C:\Program Files\LANDesk\LDClient\sdmcache\LANDesk\LDClient\sdmcache\ldlogon\packages\softwarefiles\v7.6.1045\x86\

The part in bold seems to be duplicated.

If I run the script from the command prompt window, it works OK.

Anyone ever see this? How does @scriptdir get it's value? Ideas on a work around?

here is the code for anyone interested

$ldclientdir = envget("LD_CLIENT_DIR")

$file = FileOpen("c:\windows\temp\output.txt", 1)


if ubound($cmdline) > 0 Then
    runwait($ldclientdir & '\sdclient.exe /msg="Rebooted. Installing software 7.6','',@SW_HIDE)
Else
    runwait($ldclientdir & '\sdclient.exe /msg="Installing software 7.6','',@SW_HIDE)
endif

if @osarch = "X64" then ;+--- run x64 installer
    filewrite($file, 'msiexec.exe /i "'& @ScriptDir & '\x64\software.msi" /quiet /norestart /l*v "' & @tempdir & '\software_7.6_install_x64.log" REBOOT=REALLYSUPPRESS TRANSFORMS="' & @scriptdir & '\x64\_MSI_Reboot_Actions.mst"')
    $returnval = runwait('msiexec.exe /i "'& @ScriptDir & '\x64\software.msi" /quiet /norestart /l*v "' & @tempdir & '\software_7.6_install_x64.log" REBOOT=REALLYSUPPRESS TRANSFORMS="' & @scriptdir & '\x64\_MSI_Reboot_Actions.mst"')
Else ;'+--- run x86 installer
    filewrite($file, 'msiexec.exe /i "'& @ScriptDir & '\x86\software.msi" /quiet /norestart /l*v "' & @tempdir & '\software_7.6_install_x86.log" REBOOT=REALLYSUPPRESS TRANSFORMS="' & @scriptdir & '\x86\_MSI_Reboot_Actions.mst"')
    $returnval = runwait('msiexec.exe /i "'& @ScriptDir & '\x86\software.msi" /quiet /norestart /l*v "' & @tempdir & '\software_7.6_install_x86.log" REBOOT=REALLYSUPPRESS TRANSFORMS="' & @scriptdir & '\x86\_MSI_Reboot_Actions.mst"')
endif
Fileclose($file)

;Return the value that's returned by msiexec.
exit($returnval)
Edited by Lunchbox
Link to comment
Share on other sites

Last I checked, its value comes from a call to GetFullPathName() during script initialization, but that is not important right now as for the most part @ScriptDir has always been very reliable.

Are you sure that's the value in @ScriptDir, and that it is not correct? Post your output.txt file.

Link to comment
Share on other sites

I don't have your software, so I can't troubleshoot. Here's a forum where someone was having similar troubles:

http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=200459

Perhaps their findings can help you.

#include <ByteMe.au3>

Link to comment
Share on other sites

Thanks everyone.

I have the double quotes taken care of in the script. Look closely :)

Here is the output.txt file.

msiexec.exe /i "C:\Program Files\LANDesk\LDClient\sdmcache\LANDesk\LDClient\sdmcache\ldlogon\packages\software\v7.6.1045\x86\software.msi" /quiet /norestart /l*v "C:\WINDOWS\TEMP\software_7.6_install_x86.log" REBOOT=REALLYSUPPRESS TRANSFORMS="C:\Program Files\LANDesk\LDClient\sdmcache\LANDesk\LDClient\sdmcache\ldlogon\packages\software\v7.6.1045\x86\MSI_Reboot_Actions.mst"

In this case I could hard code the path in the script as it will be the same everywhere. I hate that work around, though. ;)

I think I might try to fire up process monitor when this is running and seeing if I can see anything odd about how sdclient.exe is starting my script..

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...