Jump to content

Recommended Posts

Posted (edited)

I write the code down below:

#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>

Send("#r")
Sleep(1000)
Send("cmd.exe{ENTER}")
WinWait("C:\Windows\system32\cmd.exe")
$cmdHandle = WinGetHandle("C:\Windows\system32\cmd.exe")

_CLEANDIR($cmdHandle)

Exit

;_CLEANDIR
Func _CLEANDIR($cmdHandle)
    WinActivate($cmdHandle)
    $vDIR = _CMDREAD("C:\cygwin\bin\ls -1 c:\TEST | gawk '{print "del /Q c:'\'\TEST'\'\" $1 "'\'\*.*"}'")
    Local $i=0
    For $vElement In $vDIR
        MsgBox($MB_SYSTEMMODAL, "", "For Loop: " & $vElement)
    Next
    ;MsgBox($MB_SYSTEMMODAL, "", "DIR List: " & $vDIR)
    Return
EndFunc;==> _CLEANDIR

;_CMDREAD
Func _CMDREAD($Command)
   Local $CMDRead
   MsgBox($MB_SYSTEMMODAL, "", "DIR List: " & $Command)
   $CMD = Run(@ComSpec & " /c " & $Command, @SystemDir, @SW_HIDE, $STDOUT_CHILD)
   While 1
      $CMDRead &= StdoutRead($CMD)
      If @error Then ExitLoop
   WEnd
   Return $CMDRead
EndFunc ;==>_CMDREAD

I tried different quoting of the quotes in the _CMDREAD function call (line 17) but i can't compile it. I'am absolute new to AutoIt, search already the forum and google, but didn't find the answer to my problem.

On command line it works fine:

C:cygwinbinls -1 c:TEST | gawk '{print "del /Q c:''TEST''" $1 "''*.*"}'

Maybe someone can help.

 

Thanks in advance!

Edited by falcon1406

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
×
×
  • Create New...