Jump to content

Wraping problem


Recommended Posts

I need to wrap this command correctly but it didn't work correctly , the outgoing command need to look like

psexec -i -s -d -u $user -p $pass @$hostfile notepad.exe $msgfile

thank you to help me

$rslt = Run(@ComSpec & " /c psexec -i -s -d -u " & '"' &  GUICtrlRead($user) & '" -p ' & '"' &  GUICtrlRead($pass) & '"' &  " @ " & '"' & GUICtrlRead($hostfile) & '" ' & "notepad.exe " & '"' & GUICtrlRead($msgfile) & '"', @SystemDir, @SW_HIDE, $STDERR_MERGED + $STDOUT_CHILD)
Link to comment
Share on other sites

Hello DarkAnel,

If I recall correctly, you cannot nest functions inside a Run() function, or maybe it had something to do with using COM. However, read the values into variable first, then give it a try:

Local $ID_user = GUICtrlRead($user)
Local $ID_pass = GUICtrlRead($pass)
Local $ID_hostfile = GUICtrlRead($hostfile)
Local $ID_msgfile = GUICtrlRead($msgfile)
$rslt = Run(@ComSpec & " /c psexec -i -s -d -u " & '"' &  $ID_user & '" -p ' & '"' & $ID_pass & '"' &  " @ " & '"' & $ID_hostfile & '" ' & "notepad.exe " & '"' & $ID_msgfile & '"', @SystemDir, @SW_HIDE, $STDERR_MERGED + $STDOUT_CHILD)

Realm

Edited by Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

Hello DarkAnel,

If I recall correctly, you cannot nest functions inside a Run() function, or maybe it had something to do with using COM. However, read the values into variable first, then give it a try:

Local $ID_user = GUICtrlRead($user)
Local $ID_pass = GUICtrlRead($pass)
Local $ID_hostfile = GUICtrlRead($hostfile)
Local $ID_msgfile = GUICtrlRead($msgfile)
$rslt = Run(@ComSpec & " /c psexec -i -s -d -u " & '"' &  $ID_user & '" -p ' & '"' & $ID_pass & '"' &  " @ " & '"' & $ID_hostfile & '" ' & "notepad.exe " & '"' & $ID_msgfile & '"', @SystemDir, @SW_HIDE, $STDERR_MERGED + $STDOUT_CHILD)

Realm

You can nest functions in run commands.

Sometimes the deal with the run command is the way you point to a file, I like to use the filegetshortname() command on everything that is passed to the run command (that is a file) so as to avoid errors with directories with spaces in them.

Also, try including the path to psexec and notepad

Edited by ApudAngelorum
Link to comment
Share on other sites

I apologize for being wrong, I have been reading values to variables for awhile now, because I was under the assumption that they could not be nested.

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

I have try what you have said Realm, i will give all my code it will be more simple thanks for your help

the notepad popup but the notepad don't open $msgfile

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <Constants.au3>
#include <StaticConstants.au3>
Local $Gui010  = GUICreate("RemotePopUp", 800, 600)
Local $Button1 = GUICtrlCreateButton("Send PSEXEC",225,140,400,25)
        GUICtrlSetBkColor($Button1,0xaaaaaa)
                 GUICtrlSetFont($Button1,10,800,default,'times new roman')
Local $clear   = GUICtrlCreateButton("Clear Display", 700, 10, 90, 25)
                 GUICtrlSetBkColor($clear,0xaaaaaa)
                 GUICtrlSetFont($clear,10,800,default,'times new roman')
Local $about   = GUICtrlCreateButton("About", 700, 40, 90, 25)
                 GUICtrlSetBkColor($about,0xaaaaaa)
                 GUICtrlSetFont($about,10,800,default,'times new roman')
                 GUICtrlCreateLabel("User Name",150,15,75,25)
        GUICtrlCreateLabel("Password",150,45,75,25)
        GUICtrlCreateLabel("Host File",150,75,75,25)
     GUICtrlCreateLabel("Msg File",150,105,75,25)
Local $user = GUICtrlCreateEdit('',225,10,180,25,$ss_sunken)
                 GUICtrlSetFont($user,12,800)
                 GUICtrlSetState($user,$gui_focus)
Local $pass = GUICtrlCreateEdit('',225,40,180,25,$ss_sunken)
                 GUICtrlSetFont($pass,12,800)
                 GUICtrlSetState($pass,$gui_focus)
Local $hostfile = GUICtrlCreateEdit('c:Techip.txt',225,70,400,25,$ss_sunken)
                 GUICtrlSetFont($hostfile,12,800)
                 GUICtrlSetState($hostfile,$gui_focus)
Local $msgfile = GUICtrlCreateEdit('infohhrinfoappsoftwaretest.txt',225,100,400,25,$ss_sunken)
                 GUICtrlSetFont($msgfile,12,800)
                 GUICtrlSetState($msgfile,$gui_focus)
Local $Edit010 = GUICtrlCreateEdit("", 10,200,780,350, $ES_AUTOVSCROLL + $WS_VSCROLL + $ws_hscroll + $es_readonly)
                 GUICtrlSetFont(-1,8.5,800,default,'courier new')
Local $help = GUICtrlCreateButton("Help", 700, 70, 90, 25)
                 GUICtrlSetBkColor($help,0xaaaaaa)
                 GUICtrlSetFont($help,10,800,default,'times new roman')
GUISetState(@SW_SHOW)
net_properties()
Func net_properties()
    Local $rslt,$out
    While 1
            $msg = GUIGetMsg()
            Select
                Case $msg = $GUI_EVENT_CLOSE
                    ExitLoop
     Case $msg = $Button1  
     $rslt = Run(@ComSpec & " /c psexec -i -s -d -u " & '"' &  GUICtrlRead($user) & '" -p ' & '"' & GUICtrlRead($pass) & '"' &  " @" & '"' & GUICtrlRead($hostfile) & '"' & " notepad.exe " & '"' & GUICtrlRead($msgfile) & '"', @SystemDir, @SW_HIDE, $STDERR_MERGED + $STDOUT_CHILD)
                    ;$rslt = Run(@ComSpec & " /c psexec -i -s -d -u " & '"' &  GUICtrlRead($user) & '" -p ' & '"' & GUICtrlRead($pass) & '" ' & "notepad.exe " & '"' & GUICtrlRead($hostfile) & '"' &  " @ " & '"' & GUICtrlRead($msgfile) & '"', @SystemDir, @SW_HIDE, $STDERR_MERGED + $STDOUT_CHILD)
        ;$rslt = Run(@ComSpec & " /c psexec -i -s -d -u " & '"' &  GUICtrlRead($user) & '" -p ' & '"' & GUICtrlRead($pass) & '"' &  " @" & '"' & GUICtrlRead($hostfile) & '" ' &  "notepad.exe " & '"' & GUICtrlRead($msgfile) & '"', @SystemDir, @SW_HIDE, $STDERR_MERGED + $STDOUT_CHILD)
                
     While 1
                        $out = StdoutRead($rslt)
                        If @error then exitloop
                        GUICtrlSetData($edit010,$out & @lf,1)
                    WEnd
     Case $msg = $help
     MsgBox(0, "Help", "Il est important de mettre le username et password pour pouvoir executer une tâche sur un pc distant. File: le fichiers que notepad va ouvrir, il doit être situé sur un lecteur réseau accèssible à tous")
        Case $msg = $about
     MsgBox(0, "About", "This Script was created by Eric Boudreau")
                 Case $msg = $clear
                    GUICtrlSetData($edit010,"")
            EndSelect
    WEnd
EndFunc
Edited by DarkAnel
Link to comment
Share on other sites

i have made the research but i have find nothing about my problem but i have learn a couple thing, but now my problem is not solved, all work good the notepad open but notepad don't take my last variable $msgfile to open the right text file on the computer

what i can do i have no idea ;)

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