New
#11
What account is it running under when scheduled? Make sure it's yours perhaps?
Yes, sure it's mine. There is only one account on my notebook.
Many scheduled task run under System, not your account, which is why I asked. You may want to double check as it sure sounds like that may be the problem.
Scheduled task "Computer Detective", which runs ks1.bat every x minutes is running on my account.
AH, okay. So you are not running ks1.bat directly from the scheduler. That was not obvious from what you had posted previously.
Most likely, when Computer Detective launches ks1.bat, the default directory is the one Computer Detective is in, not where ks1.bat is, unless they are in the same place.
Create a new, temporary ks1.bat that does this:
dir * > C:\Users\youraccount\Desktop\Whatdir.txt
Run it from Computer Detective and see what is in Whatdir.txt when it ends.
ks1t.bat
Whatdir.txtCode:@echo off cd.. cd results md %date% cd %date% echo Computer detective is running... echo. echo Copying active files list... dir * > C:\Users\Neone\Desktop\Whatdir.txt echo Task completed. Computer detective closes... ping -n 3 127.0.0.1 >nul exit
Part of main ComputerDetective.batCode:Volume in drive C is Windows Volume Serial Number is 8619-62BF Directory of C:\Windows\2012.10.29 2012.10.29 09:51 <DIR> . 2012.10.29 09:51 <DIR> .. 0 File(s) 0 bytes 2 Dir(s) 267.091.505.152 bytes free
Code:echo Input txt files update time in minutes: set /p minutes= cd.. cd Computer detective cd tasks schtasks /create /sc minute /mo %minutes% /tn "Computer Detective" /tr %homedrive%%homepath%\Desktop\OSND\ComputerDetective\tasks\ks1t.bat echo.
How my files are arranged:
dir of osnd:
Tools - here all programs which are being run by UsefulTools.bat are locatedCode:Volume in drive C is Windows Volume Serial Number is 8619-62BF Directory of C:\Users\Neone\Desktop\osnd 2012.10.25 16:53 <DIR> . 2012.10.25 16:53 <DIR> .. 2012.10.25 16:09 <DIR> Tools 2012.10.21 15:54 <DIR> ComputerDetective 2012.10.25 16:48 934 UsefulTools.bat 2 File(s) 113.317 bytes 4 Dir(s) 267.092.324.352 bytes free
ComputerDetective - here files of ComputerDetective are stored. In tasks subfolder there is ks1.bat, and other ks's. In results subfolder results of ks's.
UsefulTools - this is main batch file which runs other batch files from Tools directory, and one of them is ComputerDetective.bat
Don't mean to jump in and confuse the issue, but have you used Task History to see if there are any error messages?
When i have a problem with a scheduled task here is what i do:
1) Enable All tasks History
2) Manually run the task from the scheduler
3) Look at the History tab for the taskClick refresh until the task is completed4) Disable All tasks History when all errors are resolved and the task works
Check each step in the task looking for error(s)
Check and enable other logs if needed
Find a fix for any error(s)
Re-run the task
I also make sure the BAT file works on it's own before trying to debug a scheduled task that runs a BAT file.
There is no error messages. Everything now works fine, just ks1.bat creates folder and txt file in C:/Windows, not in ../osnd/ComputerDetective/results
Tomorrow I need to show this program to my lecturer and I'll get mark for it. So I am waiting for last suggestions..