Xibalba Posted July 27, 2022 Posted July 27, 2022 I have this .bat file @ECHO OFF set IPADDRESS=192.168.1.101 set INTERVAL=60 :PINGINTERVAL ping %IPADDRESS% -n 1 if errorlevel 1 echo %date% %time% >> c:\pinger\pinger-failurelog.txt timeout %INTERVAL% GOTO PINGINTERVAL Which works fine. In Windows Task Scheduler, I just create a new task, choose this .bat file as action, it runs and produce the log file. However, I don't want the command prompt to be visible with the 60 sec countdown etc. I simply want to make an exe from a AutoIt script, and run that instead in the task. Then there won't be a cmd window at all, correct? There will only be an icon on task bar if it runs. How to achieve this? Thanks
rsn Posted July 27, 2022 Posted July 27, 2022 Why not check the hidden box in the properties of the task?
Nine Posted July 27, 2022 Posted July 27, 2022 Compile it. Run it from DOS console. #AutoIt3Wrapper_Change2CUI=y #include <Date.au3> HotKeySet("+{END}", _Exit) ; shift-end Local Const $sAddress = "www.google.com", $iTimeOut = 60 Local $iResult While True $iResult = Ping($sAddress, 1000) ConsoleWrite($iResult & " msec" & @CRLF) If @error Then FileWriteLine("Error.log", "Error " & @error & " @ " &_Now()) Sleep($iTimeOut * 1000) WEnd Func _Exit() Exit EndFunc “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Xibalba Posted July 28, 2022 Author Posted July 28, 2022 8 hours ago, rsn said: Why not check the hidden box in the properties of the task? doesnt work. still shows a cmd prompt when run
Xibalba Posted July 28, 2022 Author Posted July 28, 2022 8 hours ago, Nine said: Compile it. Run it from DOS console. #AutoIt3Wrapper_Change2CUI=y #include <Date.au3> HotKeySet("+{END}", _Exit) ; shift-end Local Const $sAddress = "www.google.com", $iTimeOut = 60 Local $iResult While True $iResult = Ping($sAddress, 1000) ConsoleWrite($iResult & " msec" & @CRLF) If @error Then FileWriteLine("Error.log", "Error " & @error & " @ " &_Now()) Sleep($iTimeOut * 1000) WEnd Func _Exit() Exit EndFunc But i dont want to run a cmd prompt... or at least hide it completely
Nine Posted July 28, 2022 Posted July 28, 2022 Then run it directly and remove consoleWrite (useless)... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
rsn Posted July 28, 2022 Posted July 28, 2022 (edited) Hiding the cmd prompt requires running it as the "system" user versus any other account. Slipped my mind until you mentioned it and I tested it. Nine's solution is solid. I especially like the hotkey to terminate it. Edited July 28, 2022 by rsn Image
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