Jump to content

Error in RUN command


Recommended Posts

Hello every one,

I have a problem with "RUN" Command and @comspec.

My code:

Dim $User=@UserName

Dim $Directory="\\2950-1\DATAUSERS_quotas\" & $User

;Dim $commande='c:\windows\system32\cmd.exe /c Echo o| cacls \\2950-1\DATAUSERS_quotas\' & $User & ' /C /G ' & $User & ':F "Admins du domaine":F'

Dim $commande='/c Echo o| cacls \\2950-1\DATAUSERS_quotas\' & $User & ' /C /G ' & $User & ':F "Admins du domaine":F'

RunAsSet("my_user","my_domain","my_password")

DirCreate($Directory)

;RunWait($commande,'',@SW_HIDE)

RunWait(@ComSpec & $commande,'',@SW_HIDE)

RunAsSet()

When i launch my program in AutoIT with the command "RunWait(@ComSpec & $commande,'',@SW_HIDE)" i have this error :

C:\Documents and Settings\cth\Mes documents\test.au3 (15) : ==> Unable to execute the external program.:

RunWait(@ComSpec & $commande,'',@SW_HIDE)

Paramètre incorrect.

If I replace "@ComSpec" by the path of %ComSpec% (Dim $commande='c:\windows\system32\cmd.exe /c Echo o| cacls \\2950-1\DATAUSERS_quotas\' & $User & ' /C /G ' & $User & ':F "Admins du domaine":F' and RunWait($commande,'',@SW_HIDE)), it's ok on my workstation

But on another workstation it does not work why this error :

Line -1:

Error : Unable to execute the external program.

the name of directory is incorrect

For this another workstation if I use this command : "RunWait(@ComSpec & $commande,'',@SW_HIDE)" and i build my program, It's does not work too.

You can help me to work my program thank you for you help

Christian

PS : Sorry for my English

Link to comment
Share on other sites

My code:

Dim $commande='/c Echo o| cacls \\2950-1\DATAUSERS_quotas\' & $User & ' /C /G ' & $User & ':F "Admins du domaine":F'
Put a space before "/c":
Dim $commande=' /c Echo o| cacls \\2950-1\DATAUSERS_quotas\' & $User & ' /C /G ' & $User & ':F "Admins du domaine":F'

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...