Sign in to follow this  
Followers 0
caramen

Batch file wont be lunched

8 posts in this topic

Hi all and THX.

Case $Langues

                           Local $Password= "aaaaaaaaa"
                           Local $UID= "bbbbbbbbbb"

                           GUISetState(@SW_SHOW, $Console)

                                          WinMove ("Console","",0,0)
                                          WinMove ("Migration profil","",300,0)

                           _GUICtrlListView_AddItem($ConsoleArea,"Changement de langue admin*...")
                           _GUICtrlListView_EnsureVisible($ConsoleArea, _GUICtrlListView_GetItemCount($ConsoleArea)-1)

                           Sleep (1000)

                           run (@SCRIPTDIR&"UI-FR.BAT" )


                           RunAsWait ($Password,@ComputerName,$UID,0,@ScriptDir&"\UI-FR")

                           MsgBox ( $MB_SYSTEMMODAL , "Migration V1.0", "Reboot necessaire.")

                           _GUICtrlListView_AddItem($ConsoleArea,"Langue changé reboot necessaire.")
                           _GUICtrlListView_EnsureVisible($ConsoleArea, _GUICtrlListView_GetItemCount($ConsoleArea)-1)

This case just lunching a *.BAT file but when i click the buttom the batch file is not lunched ... BUT the message box is coming so i am sure it s called properly but why does this batch is not lunched.... ?

Any one got a solution ?

Share this post


Link to post
Share on other sites



The run command is for executables. Try using ShellExecute instead.


RAID Calculator | Software Installer

The truth has been suppressed since the dawn of time.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Willl it work for a RunAS with shell exec ?

I need admin right becose i am changing a reg key with that

Edited by caramen

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Sorry, ShellExectue will not work for you then. Below is an example of how it can work. Note that you must use the full path of the script. If there are spaces in the path name, you will need to include quotes.

Path without spaces:

RunAs("MyLoginName", @ComputerName, "password", 1, @ComSpec & " /c start c:test.bat")

Path with spaces:

RunAs("MyLoginName", @ComputerName, "password", 1, @ComSpec & "/c start " & '"' & "c:Program Filestest.bat" & '"')

Edited by abberration
1 person likes this

RAID Calculator | Software Installer

The truth has been suppressed since the dawn of time.

Share this post


Link to post
Share on other sites

So confusing...

run (@SCRIPTDIR&"UI-FR.BAT" )

- No "" between @ScriptDir and your file

RunAsWait ($Password,@ComputerName,$UID,0,@ScriptDir&"\UI-FR")

- No file extension after UI-FR.

- Your password is where your username should be.

- You have your $UUID where the password should go

- And no idea what the username is supposed to be, is that @ComputerName or $UUID or what?????

- And... If your path contains spaces it will fail.

At least take some darn time and read what the functions need to run before posting help me code.

How I would do it?
 
RunWait(@ComSpec & " /c " & '"' & @ScriptDir & '\UI-FR.bat"', "", @SW_HIDE)
 
RunAsWait($UUID, @ComputerName, $Password, 0, @ComSpec & " /c " & '"' & @ScriptDir & '\UI-FR.bat"', "", @SW_HIDE)
No idea if your $UUID or @ComputerName are in the correct places!

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

 

So confusing...

run (@SCRIPTDIR&"UI-FR.BAT" )

- No "" between @ScriptDir and your file

RunAsWait ($Password,@ComputerName,$UID,0,@ScriptDir&"\UI-FR")

- No file extension after UI-FR.

- Your password is where your username should be.

- You have your $UUID where the password should go

- And no idea what the username is supposed to be, is that @ComputerName or $UUID or what?????

 

- No file extension after UI-FR. > Yeah i was trying bat and cmd and forget to replace before post

- Your password is where your username should be. > becose i prefered to see UID before password and forget to change place of values too but not important since i dont see the batch lunched

- You have your $UUID where the password should go >  IDEM

- And no idea what the username is supposed to be, is that @ComputerName or $UUID or what?????

the log have to be completed like this ....

FRNB101010$UID(Local administrator) //// Tab //// $Password 

The @computername is to get the local name of the computer to be loged as a local admin ...

Share this post


Link to post
Share on other sites

There was no need to explain yourself, you accepted an answer, but thank you.

But that leaves even more disappointment really, the fact that "you preferred to see UID before password" and "it's not important".

Yes, it's very very important.  You're asking for help, it's very important that you have all your ducks in a row, because then you're wasting our time in trying to figure things out why things are failing for you.

I don't know what IDEM means, but I'll assume it is some slang meaning that it's the same as you mentioned before, so if that's the case... I'll just leave this as IDEM.

But again, thank you for explaining


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Case $UAC


                 RunAsWait($UID, @ComputerName, $Password, 0, @ComSpec & " /c " & '"' & @ScriptDir & '\UAC.bat"', "", @SW_HIDE)

For exemple this is not working.

 

SmOke_N:

 

I am realy sorry... i am very very busy and trying to get somthing work and working at same time that's why ...

Thx you too :)

Edited by caramen

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