Jump to content

Run $cmd does not give same results as cmd box


Recommended Posts

Why cant i get this simple codesample working, yes it does wat it must do but the result are not good. Kix32 gives me "ERROR : failed to find/open script!" even when i hardcode the same command line in de code it doesnt work, why?

If $CmdLine[0] < 2 Then Exit(1)

runKix($CmdLine[1], $CmdLine[2])


Func runKix($context, $script)      
        If $context == "/adm" Then
            
            RunAsSet("administrator", @LogonDomain, "password")
            $cmd = "kix32.exe " & $Script
            
MsgBox(4096, "Debug", $cmd , 10)    
    
        ; 0 -> Do not display RunWait errors
            Opt("RunErrorsFatal", 1)

            RunWait($cmd, ".")
                
        ; Reset user's permissions
            RunAsSet()
            Exit(0)
        EndIf
EndFunc

Grtx Sno. The Novice Newbie.

Link to comment
Share on other sites

By what method are you using, to run this. Compiled, editor, right-click?

Yes

What does the msgbox report. Is it the full script name, that you would expect?

<{POST_SNAPBACK}>

Yes, also tried variation as

RunAsSet("administrator", @LogonDomain, "password")
            $cmd = "start " & @LogonServer & "\netlogon\kix32.exe " & $Script
            $cmd1 = (@ComSpec & " /c " & $cmd)

Any idea?

ANd yes i know that compiling the password is bad :(

Edited by sno

Grtx Sno. The Novice Newbie.

Link to comment
Share on other sites

With RunWait()

- You don need to specify a full path to the file. Leave out the working directory parameter, if not needed.

With Comspec.

- Double check your start command. The start command has changed of late? Now has title parameters etc. You may need to use: Start "" path\file.exe ?

Link to comment
Share on other sites

With RunWait()

- You don need to specify a full path to the file. Leave out the working directory parameter, if not needed.

With Comspec.

- Double check your start command. The start command has changed of late? Now has title parameters etc. You may need to use: Start "" path\file.exe ?

<{POST_SNAPBACK}>

I dont understand why it does not work, il be debuging some more when i get home. but for now all variations a tried fail (and i think i have tried quit a couple)

Grtx Sno. The Novice Newbie.

Link to comment
Share on other sites

You could try this with your last try

RunAsSet("administrator", @LogonDomain, "password")
            $cmd = 'start "" "' & @LogonServer & '\netlogon\kix32.exe" "' & $Script & '"'
            RunWait(@ComSpec & " /c " & $cmd)
Link to comment
Share on other sites

You could try this with your last try

RunAsSet("administrator", @LogonDomain, "password")
            $cmd = 'start "" "' & @LogonServer & '\netlogon\kix32.exe" "' & $Script & '"'
            RunWait(@ComSpec & " /c " & $cmd)

<{POST_SNAPBACK}>

Almost :-)

$cmd = '"' & @LogonServer & '\netlogon\kix32.exe" "' & $Script & '"'
            
MsgBox(4096, "Debug", $cmd , 10)    
RunWait($cmd, ".", @SW_MAXIMIZE )

This does the trick tho, man many thx for that """""" stuf!! :(

Any idea where i can read about the syntax used (double "" and so on)

i was looking for it in the help earlyer.

Grtx Sno. The Novice Newbie.

Link to comment
Share on other sites

Almost :-)

$cmd = '"' & @LogonServer & '\netlogon\kix32.exe" "' & $Script & '"'
            
MsgBox(4096, "Debug", $cmd , 10)    
RunWait($cmd, ".", @SW_MAXIMIZE )

This does the trick tho, man many thx for that """""" stuf!!  :(

Any idea where i can read about the syntax used (double "" and so on)

i was looking for it in the help earlyer.

<{POST_SNAPBACK}>

I can point you, in the right direction.

It is located in AutoIt Help. Look in Contents, then open the Language Reference topic folder, then click on Datatypes. Or see online here.

Strings:

Basically, you can put double quotes, inside single quotes. This allows the double quotes to be passed to the command interpreter, etc. ( Which is my preference. I use single quotes by default, with AutoIt. Seems easier to type and easier when you need to pass double quotes. )

Or you can double up the double quotes. The inner double quotes will be passed to the command interpreter etc.

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