Jump to content

Recommended Posts

Posted (edited)

Hello AutoIt community,

I would like to send several CMD commands. My script is running the commands well but looks like the echo command does not appears on screen (see attached screenshot)

 

echo.png

 

$CMD = 'echo C:\Users>ipconfig /flushdns && ' & _
       'ipconfig /flushdns && ' & _
        'echo C:\Users>net stop dnscache && ' & _
        'net stop dnscache && ' & _
        'echo C:\Users>ipconfig /flushdns && ' & _
        'ipconfig /flushdns && ' & _
        'echo C:\Users>net start dnscache && ' & _
        'net start dnscache && ' & _
        'echo C:\Users>ipconfig /flushdns && ' & _
        'ipconfig /flushdns && ' & _
        'echo C:\Users>ipconfig /all && ' & _
        'ipconfig /all && ' & _
        'echo C:\Users>hostname && ' & _
        'hostname'
        
RunWait('"' & @ComSpec & '" /k ' & $CMD, @SystemDir)

 

Is there a way to display e.g.:'echo C:\Users>ipconfig /flushdns ?
 

Best regards

Hendrik

Edited by hendrikhe
Posted (edited)

I believe your > character is the culprit.  You are redirecting the echo output to a file called ipconfig & hostname respectively.  Try escaping the > character.
 

$CMD = 'echo C:\Users^>ipconfig /flushdns && ' & _
       'ipconfig /flushdns && ' & _
        'echo C:\Users^>net stop dnscache && ' & _
        'net stop dnscache && ' & _
        'echo C:\Users^>ipconfig /flushdns && ' & _
        'ipconfig /flushdns && ' & _
        'echo C:\Users^>net start dnscache && ' & _
        'net start dnscache && ' & _
        'echo C:\Users^>ipconfig /flushdns && ' & _
        'ipconfig /flushdns && ' & _
        'echo C:\Users^>ipconfig /all && ' & _
        'ipconfig /all && ' & _
        'echo C:\Users^>hostname && ' & _
        'hostname'
        
RunWait('"' & @ComSpec & '" /k ' & $CMD, @SystemDir)

 

...just curious...flushdns cache three times?    

Edited by spudw2k
grammar

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...