windowscommand-linescheduled-taskssahi

Scheduling automated scripts suite run from schedular


So I tried and tried but couldn't figure out this one for some reason.

how can I run a task from a desired directory instead of System32 directory where cmd.exe is. so, when I schedule a task and try to run it ..

command prompt suppose to go to "c:\users\aaa\bbb\ccc" and then pass the argument.

Instead, It's starts at c:\Windows\System32 and fails.

Could anybody help me with this please?

I really appreciate it.

Thank you.

EDIT --

so, now I have a run.bat file with following content in it ...

 C:\Users\aaa\bbb\ccc\dd (location to my testrunner.bat file) 
 testrunner.bat Scripts/all.suite website-address ie (command for the task I wanna perform)

 net stop schedule (since window is poping up and going away way to fast, I added this to stop it (not working))

Solution

  •  type run.bat
    
     @echo off
     cd C:\Users\aaa\bbb\ccc\dd
     rem this will show all files in dir 
     rem is the file you're expecting listed?
     dir 
    
     rem notice how you can make comments with a leading rem(ark)
    
     @echo starting scripts\all.suite
     rem you have to change this to have the full path using Windows X:\dir\dir conventions
     c:\home\Scripts\all.suite website-address
     @echo done running scripts\all.suite website-address
    
     @echo shutting down
     net stop schedule
    

    So its still not clear exactly to me your goal. The reason I added the cd c:\... command is that will **C**hange **D**irectory to the path specified.

    This is what you need so you can "run a task from a desired directory instead of System32".

    Copy everything from the first @echo off to the last net stop and using notepad, paste it into a file, fix command names and paths website-urls, etc, then save that file to c:\temp\testrunner.bat.

    Open a cmd.exe window and test that the script works. Just paste c:\temp\testrunner.bat on to cmd-line and hit enter. If that works, then made an entry in the scheduler to run c:\temp\testrunner.bat . I don't know the specifics of running a script for scheduler, so look for clues on the input screen. Is the an option to run 'now'?

    If the .bat file doesn't work from the command-line, then you have to fix the file before you try running it in the scheduler. As your command Scripts/all.suite website-address is a little vague, you'll do better to post a new question asking for help to fix the .bat file and use a sample command that people will be able to use on their PCs at home.

    IHTH.