在 Windows 中设置 cron 作业 [英] Setting up a cron job in Windows

查看:32
本文介绍了在 Windows 中设置 cron 作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须每天从 SFTP 服务器下载文件.我有从服务器检索文件的程序,但我正在考虑设置一个 cron 作业(或任何类似的东西)来自动化它.我们是一家 Windows 商店,需要在 Windows 中设置 cron 作业.

I have to download a file from an SFTP server everyday. I have the program which retrieves the file from the server but I was thinking of setting up a cron job (or anything similar) to automate that. We are a Windows shop and need to set up the cron job in Windows.

推荐答案

相当于 cron 作业的窗口是计划任务.

The windows equivalent to a cron job is a scheduled task.

可以按照 AlexRudu,但也可以使用 schtasks 命令行完成(例如,如果您需要编写脚本或将其添加到版本控制).

A scheduled task can be created as described by Alex and Rudu, but it can also be done command line with schtasks (if you for instance need to script it or add it to version control).

示例:

schtasks /create /tn calculate /tr calc /sc weekly /d MON /st 06:05 /ru "System"

创建任务计算,它会在每个星期一的 6:05 启动计算器(calc)(如果你需要的话.)

Creates the task calculate, which starts the calculator(calc) every monday at 6:05 (should you ever need that.)

可以在此处找到所有可用命令:http://technet.microsoft.com/en-us/library/cc772785%28WS.10%29.aspx

All available commands can be found here: http://technet.microsoft.com/en-us/library/cc772785%28WS.10%29.aspx

它适用于 windows server 2008 以及 windows server 2003.

It works on windows server 2008 as well as windows server 2003.

这篇关于在 Windows 中设置 cron 作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆