Schtasks not working properly, Windows 7

Page 2 of 3 FirstFirst 123 LastLast

  1. Posts : 6,285
    Windows 10 Pro X64
       #11

    What account is it running under when scheduled? Make sure it's yours perhaps?
      My Computer


  2. Posts : 17
    Windows 7 Ultimate x64
    Thread Starter
       #12

    Yes, sure it's mine. There is only one account on my notebook.
      My Computer


  3. Posts : 6,285
    Windows 10 Pro X64
       #13

    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.
      My Computer


  4. Posts : 17
    Windows 7 Ultimate x64
    Thread Starter
       #14

    Computer detective task runs on my account.
    Last edited by neone; 28 Oct 2012 at 10:56.
      My Computer


  5. Posts : 6,285
    Windows 10 Pro X64
       #15

    Computer Detective? I thought we were talking about your batch file?

    What I meant was, if you open Task Scheduler, does it show your account name or SYSTEM?

    Schtasks not working properly, Windows 7-schedsys.jpg
      My Computer


  6. Posts : 17
    Windows 7 Ultimate x64
    Thread Starter
       #16

    Scheduled task "Computer Detective", which runs ks1.bat every x minutes is running on my account.
      My Computer


  7. Posts : 6,285
    Windows 10 Pro X64
       #17

    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.
      My Computer


  8. Posts : 17
    Windows 7 Ultimate x64
    Thread Starter
       #18

    ks1t.bat
    Code:
    @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
    Whatdir.txt
    Code:
     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
    Part of main ComputerDetective.bat
    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:
    Code:
     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
    Tools - here all programs which are being run by UsefulTools.bat are located
    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
      My Computer


  9. Posts : 6,330
    Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64 +Linux_VMs +Chromium_VM
       #19

    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 task
    Click refresh until the task is completed
    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
    4) Disable All tasks History when all errors are resolved and the task works

    Schtasks not working properly, Windows 7-taskschsp01.png

    I also make sure the BAT file works on it's own before trying to debug a scheduled task that runs a BAT file.
      My Computer


  10. Posts : 17
    Windows 7 Ultimate x64
    Thread Starter
       #20

    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..
      My Computer


 
Page 2 of 3 FirstFirst 123 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 07:38.
Find Us