Jump to content

Command in autoit not working


Recommended Posts

Try this :

#include <Constants.au3>

$_Pid = Run ( @ComSpec & " /c dsquery computer -name " & @ComputerName, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD )
Global $_StderrRead='', $_StdoutRead=''

While ProcessExists ( $_Pid )
    $_StderrRead = StderrRead ( $_Pid )
    If Not @error And $_StderrRead <> '' Then ConsoleWrite ( "STDERR read : " & $_StderrRead & @Crlf )
    $_StdoutRead = StdoutRead ( $_Pid )
    If Not @error And $_StdoutRead <> '' Then ConsoleWrite ( "STDOUT read : " & $_StdoutRead & @Crlf )
Wend

Edit : oups i forget the flag...

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Thanks for responding, its still not working

Dim $Map,$Mac,$OU

$Map=DriveMapGet("H:")

$OU = Run ( @ComSpec & " /c dsquery computer -name " & @ComputerName, @SystemDir, @SW_HIDE )

$Label6 = GUICtrlCreateLabel("OU Path", 32, 360, 70, 25)

GUICtrlSetFont(-1, 12, 400, 0, "Century Gothic")

$Input6 = GUICtrlCreateInput($OU, 232, 360, 145, 21)

Kindly see the attachment this is what the output is on GUI, m i doing something wrong ?

post-56306-0-88275100-1301037336_thumb.p

Link to comment
Share on other sites

When i try this, i get an output in a text file, but your command parameters give nothing !

Are you sure of them ? Posted Image

RunWait ( @ComSpec & " /c DSQuery /? >c:\output.txt", @SystemDir, @SW_HIDE )
Run ( 'notepad c:\output.txt' )
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

i need the output of the command

$OU = dsquery computer -name LD6D714BS ----->>> syntax of command needs to be corrected

and needs the output on input box

$Input6 = GUICtrlCreateInput($OU, 232, 360, 145, 21)

Tool is fully prepared except this , pls help

can we chat directly through googletalk etc. ?

Link to comment
Share on other sites

i think im not understanding what you say or im not able to get you on the point i need

i need to run command

something like this

Run ( @ComSpec & " /c dsquery computer -name " & @ComputerName, @SystemDir, @SW_HIDE )

and output should come to GUI

output should be

"CN=LD6D714BS,OU=Managed Workstations,OU=Workstations,DC=server,DC=com"

how to get it done ?

Link to comment
Share on other sites

@hiteshluthra

Here you go, try this:

#include <Constants.au3>
$iPIDOU = Run('dsquery computer -name ' & @ComputerName, @SystemDir, @SW_HIDE, $STDOUT_CHILD)
ProcessWaitClose($iPIDOU)
$sOU = StringStripWS(StdoutRead($iPIDOU), 3) ;Remove leading and trailing white spaces from the output.

Make sure dsquery is in your system PATH.

@wakillon

You didn't put the options flags, $STDOUT_CHILD + $STDERR_CHILD or $STDERR_MERGED, at the end of your Run call in your first reply. That is why your code didn't work correctly.

The DS tools, dsquery and others, are part of the Windows Server Administration Tools Pack, which you can download from Microsoft. There are versions for XP and Windows 7.

Adam

Link to comment
Share on other sites

YES YES YES YES , you all are genius......................it did work.............i was waiting for long to work it and you made it simple

i have done small mistake and you got it

you are genius

THanks a looooooooooooooooooooooooooooooooooooooooooooooooooootttttttttttttttttttttttttttttttttttttt for help

Link to comment
Share on other sites

@wakillon

You didn't put the options flags, $STDOUT_CHILD + $STDERR_CHILD or $STDERR_MERGED, at the end of your Run call in your first reply. That is why your code didn't work correctly.

The DS tools, dsquery and others, are part of the Windows Server Administration Tools Pack, which you can download from Microsoft. There are versions for XP and Windows 7.

Adam

You're right, I put the include, but i forgot them ! Posted Image

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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