Results 1 to 4 of 4

Thread: Creating a batch file to launch programs based on time

  1. #1
    Join Date
    Feb 2009
    Posts
    2

    question Creating a batch file to launch programs based on time

    I was wondering if you gurus can give me some direction...

    I run a Specials Menu on a large LCD TV at a restaurant using powerpoint. There are two specials files (lunch.pps and dinner.pps)
    When this system reboots, i want a batch file to determine which powerpoint file to open based on what time it is.

    ON BOOTUP: For instance, if it's anywhere between 11am and 3pm, open the lunch file. If its any other time, run the dinner.pps file. Make sense?

    Im already running a scheduled tasks application that shuts down one and starts up the other based on what time. This works very well. Problem is, i frequently Remote Desktop into this machine and make changes. Once those changes are made, i have to reboot the system. I then want this batch file to start the appropriate presentation since the scheduled task application only works when it sees 11am or 3pm (as in the example above)

    I figured since you can determine time and date within a batch file, can't you do an if /then/else type script within a batch? (if its *this time* then load THIS application)

    Does anyone know what the syntax is to do this?

  2. #2
    Join Date
    Jan 2009
    Posts
    1,738

    Re: Creating a batch file to launch programs based on time

    Thats simple you need to add a simple "at" command in it!


    The at command uses the following syntax:
    at \\computername time /interactive | /every:date,... /next:date,... command
    at \\computername id /delete | /delete/yes
    The following list describes the parameters that you can use with the at command:

    * \\computername: Use this parameter to specify a remote computer. If you omit this parameter, tasks are scheduled to run on the local computer.
    * time: Use this parameter to specify the time when the task is to run. Time is specified as hours:minutes based on the 24-hour clock. For example, 0:00 represents midnight and 20:30 represents 8:30 P.M.
    * /interactive: Use this parameter to allow the task to interact with the desktop of the user who is logged on at the time the task runs.
    * /every:date,...: Use this parameter to schedule the task to run on the specified day or days of the week or month, for example, every Friday or the eighth day of every month. Specify date as one or more days of the week (use the following abbreviations: M,T,W,Th,F,S,Su) or one or more days of the month (use the numbers 1 through 31). Make sure that you use commas to separate multiple date entries. If you omit this parameter, the task is scheduled to run on the current day.
    * /next:date,...: Use this parameter to schedule the task to run on the next occurrence of the day (for example, next Monday). Specify date as one or more days of the week (use the following abbreviations: M,T,W,Th,F,S,Su) or one or more days of the month (use the numbers 1 through 31). Make sure that you use commas to separate multiple date entries. If you omit this parameter, the task is scheduled to run on the current day.
    * command: Use this parameter to specify the Windows 2000 command, the program (.exe or .com file), or the batch program (.bat or .cmd file) that you want to run. If the command requires a path as an argument, use the absolute path name (the entire path beginning with the drive letter). If the command is on a remote computer, use the Uniform Naming Convention (UNC) path name (\\ServerName\ShareName). If the command is not an executable (.exe) file, you must precede the command with cmd /c, for example, cmd /c copy C:\*.* C:\temp.
    * id: Use this parameter to specify the identification number that is assigned to a scheduled task.
    * /delete: Use this parameter to cancel a scheduled task. If you omit the id parameter, all scheduled tasks on the computer are canceled.
    * /yes: Use this parameter to force a yes answer to all queries from the system when you cancel scheduled tasks. If you omit this parameter, you are prompted to confirm the cancellation of a task.

  3. #3
    Join Date
    Feb 2009
    Posts
    2

    Re: Creating a batch file to launch programs based on time

    I appreciate the quick response, except this isnt what im looking for.

    I already have a task scheduler running, and it works well. At 11am, the program will start, stop at 2:59, start the second file, then stop at 10:59am. works perfectly.

    But as changes need to be made, I log into the system, make changes, and have to reboot. Now the batch file needs to check what time it is first, then decide on WHICH file to load on startup. From there, the next trigger (i.e. 11:00 am) the scheduler will take over.

    So the end request is a batch file that checks the time upon windows startup and decides which PPS (powerpoint slide show) file to load.

    Thats all! I know this is possible, but exhausted my efforts trying to search for it online.

    Also, remember, when the reboot occurs, we could be in the middle of an existing cycle, so nothing will load until the next trigger on the task scheduler. I dont want the system to remain idle until the next one.
    Last edited by rblanda; 21-02-2009 at 09:56 PM. Reason: forgot something

  4. #4

    Re: Creating a batch file to launch programs based on time

    hi i have win2003 server domain server and 50 usres are aded to it we hav 5 eccel files which are mandatory nowi want when user login thru domain files get open automatically tel m e how to do it pl;ease i requwest friends

Similar Threads

  1. Creating a batch file to find and delete certain files
    By Damien25 in forum TroubleShoot 98
    Replies: 3
    Last Post: 11-01-2014, 08:58 AM
  2. Replies: 4
    Last Post: 03-04-2012, 06:31 PM
  3. How to run batch file at specific time
    By Campbel in forum Software Development
    Replies: 4
    Last Post: 27-03-2010, 07:32 PM
  4. How to run batch file each time computer boots
    By Gannon in forum Software Development
    Replies: 4
    Last Post: 27-03-2010, 05:53 PM
  5. Dos batch file to sort files based on file names.
    By Jon Osborn in forum Windows Server Help
    Replies: 9
    Last Post: 17-06-2009, 11:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •