hendrikhe Posted July 5, 2016 Posted July 5, 2016 (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) $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 July 5, 2016 by hendrikhe
spudw2k Posted July 5, 2016 Posted July 5, 2016 (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 July 5, 2016 by spudw2k grammar Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
hendrikhe Posted July 5, 2016 Author Posted July 5, 2016 That worked, thank you for the fast support!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now