jacq Posted May 23, 2013 Share Posted May 23, 2013 (edited) Welcome I want use this code in cmd schtasks /Create /tn ProgramName /tr "C:Program FilesCPUID HWMonitor PROHWMonitorPro_x64.exe" /rl highest /sc onevent /ec system or that without space bar schtasks /Create /tn ProgramName /tr "C:ProgramFilesCPUIDHWMonitorPROHWMonitorPro_x64.exe" /rl highest /sc onevent /ec system but when I go to the taskschd.msc and want run ProgramName doesn't work. Please help me with that just add your program and test maybe this is not working on my compiuter only. Edited May 24, 2013 by jacq Link to comment Share on other sites More sharing options...
jdelaney Posted May 23, 2013 Share Posted May 23, 2013 (edited) not sure of the actual syntax which may case your task to fail...you have to look at the failure reasons. Run (@ComSpec & " /c schtasks /Create /tn ProgramName /tr 'C:\Program Files\CPUID HWMonitor PRO\HWMonitorPro_x64.exe' /rl highest /sc onevent /ec system") you can run the task via command line, as well. I prefer importing XML file for scheduled task, so I don't need to worry about all the params (most of, that is) Edited May 23, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
jacq Posted May 23, 2013 Author Share Posted May 23, 2013 (edited) So I found the problem when I added by useing the cmd and then run taskschd.msc even as admin it still can not run from taskschd.msc file directory in this case was C:ProgramFilesCPUIDHWMonitorPROHWMonitorPro_x64.exe But when I chanege direction file directory in this case was C:UsersPatrykDesktopHWMonitorPro_x64.exe then I can run it. When I m adding using taskschd.msc I can add run even if the file is in program files. So the problem is that the program taskschd.msc can not read the file even in administrator mode when I m useing cmd to add because the file is in the Program Files. Any advice? Edited May 23, 2013 by jacq Link to comment Share on other sites More sharing options...
BrewManNH Posted May 23, 2013 Share Posted May 23, 2013 It's probably more likely that it's in "C:Program Files" and not "C:ProgramFiles" which is why it won't run it, because it's not looking for it in the right folder name. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
jacq Posted May 23, 2013 Author Share Posted May 23, 2013 It's probably more likely that it's in "C:Program Files" and not "C:ProgramFiles" which is why it won't run it, because it's not looking for it in the right folder name. I tested both still nothing I can not run. Link to comment Share on other sites More sharing options...
BrewManNH Posted May 23, 2013 Share Posted May 23, 2013 Did you surround the filename and path with quotes when you tried it? You can't just remove the spaces and expect it to work, and you could probably try it using FileGetShortName if there's spaces in either the file name or the path. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
jacq Posted May 23, 2013 Author Share Posted May 23, 2013 Did you surround the filename and path with quotes when you tried it? You can't just remove the spaces and expect it to work, and you could probably try it using FileGetShortName if there's spaces in either the file name or the path. I tried quotes. When I add by cmd with this direction C:Program FilesCPUID HWMonitorPROHWMonitorPro_x64.exe don't work But when I chanege direction file directory in this case was C:UsersPatrykDesktopHWMonitorPro_x64.exe then I can run it. Link to comment Share on other sites More sharing options...
jdelaney Posted May 23, 2013 Share Posted May 23, 2013 you need to show us the command you are attempting...if you are not surrounding the exe with quotes (when spaces are present), the syntax will fail on the add...look at my post = #2 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
jacq Posted May 23, 2013 Author Share Posted May 23, 2013 (edited) This don't work when I add by cmd with this direction C:Program FilesCPUID HWMonitorPROHWMonitorPro_x64.exe and then check this function in taskschd.msc But when I chanege direction to C:UsersPatrykDesktopHWMonitorPro_x64.exe then I can run it. So the problem is that the program taskschd.msc can not read the file even in administrator mode when I m useing cmd to add because the file is in the Program Files. #requireadmin Run("cmd.exe") Sleep(2000) ControlSend("[CLASS:ConsoleWindowClass]", "", "", 'schtasks /Create /tn Program /tr "C:\Program Files\CPUID HWMonitor PRO\HWMonitorPro_x64.exe" /rl highest /sc onevent /ec system') Sleep(1000) ControlSend("[CLASS:ConsoleWindowClass]", "", "", "{ENTER}") Edited May 23, 2013 by jacq Link to comment Share on other sites More sharing options...
jdelaney Posted May 23, 2013 Share Posted May 23, 2013 dude, use my sample...don't send to a console, run from the script...help file: Run() IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
jacq Posted May 23, 2013 Author Share Posted May 23, 2013 (edited) Ok thanks but this is not working!!!!!! How can I fix this so I can add applications from program files not desktop???? Edited May 23, 2013 by jacq Link to comment Share on other sites More sharing options...
jdelaney Posted May 23, 2013 Share Posted May 23, 2013 You tell us...what's the failure reason on attempting to /create the task? IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
jacq Posted May 23, 2013 Author Share Posted May 23, 2013 I wrote in Error is can not find the specified file (0x80070002) Look for me that the program does not have access to the file. But this not work when I m adding by cmd but when I m adding using program taskschd.msc it is working even with file from programfiles. How to repare this to work with cmd? Link to comment Share on other sites More sharing options...
BrewManNH Posted May 24, 2013 Share Posted May 24, 2013 When I run this it creates the task successfully. #RequireAdmin Run('schtasks /Create /tn Program /tr "C:\Program Files\CPUID HWMonitor PRO\HWMonitorPro_x64.exe" /rl highest /sc onevent /ec system') Although, the /ec parameter makes no sense to me, what exactly are you attempting to do with that? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
jacq Posted May 24, 2013 Author Share Posted May 24, 2013 Yes the function is created by cmd but then I can not run this becouse the file is in program files when I change the direction to not program files for example desktop then work!!Help!!Why this can't work with file from program files? Link to comment Share on other sites More sharing options...
guinness Posted May 24, 2013 Share Posted May 24, 2013 There are a couple of Task Scheduler UDFs floating around the Examples section. Have you thought about using them? UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
jacq Posted May 24, 2013 Author Share Posted May 24, 2013 (edited) So I changed this: schtasks /Create /tn Program /tr "C:Program FilesCPUID HWMonitor PROHWMonitorPro_x64.exe" /rl highest /sc onevent /ec system to: schtasks /Create /tn Program /tr """"C:Program FilesCPUID HWMonitor PROHWMonitorPro_x64.exe"""" /rl highest /sc onevent /ec system Edited May 24, 2013 by jacq Link to comment Share on other sites More sharing options...
BrewManNH Posted May 24, 2013 Share Posted May 24, 2013 You don't need a quote for each space, that's nuts. What credentials are you trying to run the task under? You never specified them, so it's probably not going to run unless you set it up correctly. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
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