2013-03-17 65 views
3

我想在指定的时间通过批处理文件启动应用程序。我能够使用它启动它:等待批处理文件,直到指定时间

@echo off 
start notepad c:\test.txt 

但是,如何让批处理文件在指定的时间启动任务?时间将在批处理文件中提及。

回答

1

您可以使用此:

@echo off 
timeout 5 
start notepad c:\test.txt 
+0

这个作品的文档,但没有任何办法来隐藏在超时过程中显示的控制台? – 2013-03-17 07:56:20

+0

想到ping命令。搜索如何睡在一个批处理文件中,会出现数以百万计的事情。 – 2013-03-17 21:19:25

2

at命令看起来非常有前途的。尝试阅读this

看来,如果您输入at 15:00 "echo Done",命令提示符将在同一天(或下一个)的下午3:00输出“完成”。

这是at命令

AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]] 
AT [\\computername] time [/INTERACTIVE] 
    [ /EVERY:date[,...] | /NEXT:date[,...]] "command" 

\\computername  Specifies a remote computer. Commands are scheduled on the 
        local computer if this parameter is omitted. 
id     Is an identification number assigned to a scheduled 
        command. 
/delete   Cancels a scheduled command. If id is omitted, all the 
        scheduled commands on the computer are canceled. 
/yes    Used with cancel all jobs command when no further 
        confirmation is desired. 
time    Specifies the time when command is to run. 
/interactive  Allows the job to interact with the desktop of the user 
        who is logged on at the time the job runs. 
/every:date[,...] Runs the command on each specified day(s) of the week or 
        month. If date is omitted, the current day of the month 
        is assumed. 
/next:date[,...] Runs the specified command on the next occurrence of the 
        day (for example, next Thursday). If date is omitted, the 
        current day of the month is assumed. 
"command"   Is the Windows NT command, or batch program to be run. 
+0

当我把它粘贴进去时,格式化有点疯狂...... – 2013-03-17 03:30:19

+0

当我在批处理文件中使用'at'时,它什么都没做。当我在命令提示符下使用它时,它说: “AT命令已被弃用,请改用schtasks.exe。” 我正在使用Windows 8. – 2013-03-17 05:39:13

+0

我个人发现schtasks太混乱了,但是您可以通过放入'schtask/create /?'找出语法。 – 2013-03-17 05:43:37