Sign in to follow this  
Followers 0
ltaudio

awstats

8 posts in this topic

After hours of playing trying to get windows server 2008 to run a batch file I have ran out of options, here is what I wish to do.

The command runs fine in CMD if I navigate to the folder and run the command with the proper attributes but if I run it from c:\ with the location in the line it fails so the script needs to navigate to the proper folder and then run the script.

The folder is: C:\inetpub\wwwroot\AWStats\cgi-bin

The command is: awstats.pl -config=website -update -output -staticlinks > awstats.website.html

Share this post


Link to post
Share on other sites



Try this:

ShellExecute('C:\inetpub\wwwroot\AWStats\cgi-bin\awstats.pl','-config=website -update -output -staticlinks > awstats.website.html','C:\inetpub\wwwroot\AWStats\cgi-bin\','open')

Share this post


Link to post
Share on other sites

Gave it a run, seems to open and it tries to read the html file it seems instead of creating the file, I looked and the creation date has not changed since I ran it manually.

Share this post


Link to post
Share on other sites

Try this script:

MsgBox(0,"",_FileAssociation('.pl'))

Func _FileAssociation($sExt)
    Const $ASSOCSTR_EXECUTABLE = 2
    Const $ASSOCF_VERIFY = 0x00000040

    Local $aCall = DllCall("shlwapi.dll", "int", "AssocQueryStringW", _
            "dword", $ASSOCF_VERIFY, _
            "dword", $ASSOCSTR_EXECUTABLE, _
            "wstr", $sExt, _
            "ptr", 0, _
            "wstr", "", _
            "dword*", 65536)

    If @error Then
        Return SetError(1, 0, ""); call failed
    EndIf

    If Not $aCall[0] Then
        Return SetError(0, 0, $aCall[5])
    ElseIf $aCall[0] = 0x80070002 Then
        Return SetError(0, 0, "{unknown}"); COM Error 0x80070002, ?The system cannot find the file specified.'
    ElseIf $aCall[0] = 0x80004005 Then
        Return SetError(0, 0, "{fail}"); E_FAIL
    Else
        Return SetError(2, $aCall[0], ""); dammit!!!
    EndIf

EndFunc  ;==>_FileAssociation

It should show you the associated executable for .pl files... should be perl.exe... Maybe there's the problem?

Share this post


Link to post
Share on other sites

upon run I get c:perl64\bin\perl.exe

Share this post


Link to post
Share on other sites

Maybe this?

Run(@ComSpec & ' /c c:\perl64\bin\perl.exe C:\inetpub\wwwroot\AWStats\cgi-bin\awstats.pl -config=website -update -output -staticlinks > awstats.website.html', 'C:\inetpub\wwwroot\AWStats\cgi-bin\', @SW_HIDE)

Share this post


Link to post
Share on other sites

Excellent work KaFu, works perfectly, Thanks for your help!

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  
Followers 0