Jump to content
Sign in to follow this  
Lunchbox

@scriptdir appears to return incorrect path

Recommended Posts

Lunchbox

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

Share this post


Link to post
Share on other sites
Lunchbox

I seem to get the same behavior with @workingdir as well. :)

Share this post


Link to post
Share on other sites
smartee

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.

Share this post


Link to post
Share on other sites
whim

Have you tried wrapping the 'offending' filepath(s) in double quotes ?

It usually helps when paths with spaces are involved.

cheers,

whim

Share this post


Link to post
Share on other sites
sleepydvdr

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>

Share this post


Link to post
Share on other sites
Lunchbox

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..

Share this post


Link to post
Share on other sites
smartee

Ok, run this from command prompt and post your Report.txt file so we can see the actual directory structure :)

dir "C:\Program Files\LANDesk" /S >Report.txt

Share this post


Link to post
Share on other sites
Lunchbox

Ok, thanks for making me go through that excersize. AutoIT is correct. Somehow LANDesk isn't behaving as I believe it should. :)

Thanks again. I think I'm good as far as AutoIT is concerned.

Share this post


Link to post
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
Sign in to follow this  

×