Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question
2

Is there a way to schedule batch jobs in MS-DOS ?

asked 2014-10-27 21:13:24 -0500

Joe Huang's avatar

updated 2015-11-28 10:47:02 -0500

I am trying to use an API on a Web weather site that limits access to no more than 10 calls per minute. Since I need to call the API 365 times, I would like to set up a batch script that calls the API once a minute. I've looked through the Web looking for how to do this, but have yet to find a way that works. Has anyone else had this need, and found a method to do this? That would save me a lot of time.

edit retag flag offensive close merge delete

Comments

1

You can do it in python directly. Much easier. I assume the website is weatherunderground? This is off-topic, so you might want to contact me in private if you need.

Mortar IO's avatar Mortar IO  ( 2014-10-28 00:18:47 -0500 )edit

I think it can not be implemented using only MS-DOS.You can use javascript/C# or other programe languages.

yongqingzhao's avatar yongqingzhao  ( 2014-10-28 08:54:40 -0500 )edit

@Ruggiero Yes, you're right. WeatherUnderground now longer allows "data scraping" of their site, replacing it with an API that limits the amount of calls depending on the subscription. I would like to contact you to discuss python, with which I'm not very familiar. My e-mail address in yjhuang@whiteboxtechnologies.com

Joe Huang's avatar Joe Huang  ( 2014-10-28 18:53:15 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted
2

answered 2014-10-28 11:05:14 -0500

Joe Huang's avatar

updated 2014-10-28 18:42:30 -0500

Following Amir's lead, I found this was very easy to do, i.e., just add a

choice /C X /T 60 /D X 1 > nul

to the batch script.. Worked great for me. I had wanted to post this as an answer to my own question, but was told by Unmet Hours that as a New User I had to wait for 2 days, so I decided to post it as a comment to Amir's answer, which Unmet Hours then asked if I wanted to convert to an answer :-)

edit flag offensive delete link more

Comments

Mysterious are the ways of UnmetHours...

__AmirRoth__'s avatar __AmirRoth__  ( 2014-10-28 19:42:48 -0500 )edit
2

answered 2014-10-29 11:05:28 -0500

To schedule in MS-DOS or the CMD shell you can use the AT command or SCHTASKS program which are available at the command line depending on your version of Windows/DOS. But these are really intended on scheduling a task that happens infrequently.

http://ss64.com/nt/at.html

For something that needs to run as often as once per minute, you should probably use something that just causes a delay for that long. The windows CMD shell/MS-DOS does not really have a SLEEP command built (it was available in an old Microsoft resource kit) so instead I have used the PING trick described on the following page:

http://ss64.com/nt/sleep.html

It is a hack but it works.

edit flag offensive delete link more

Comments

Almost 250 views! I guess there are a lot of hackers on UnmetLoads :-) :-)

Actually the AT command was the first thing I found on the Web, but when I tried it it just got me an "Access denied" slap on the face. I also tried PAUSE with a number but that didn't work either (never thought of using SLEEP), which was when I decided to post this question in lieu of further experimentation. BTW, in the CHOICE command that did work for me (see my earlier answer) the number after the T is the number of seconds to pause. For details, see 4th post in Amir's link

Joe Huang's avatar Joe Huang  ( 2014-10-29 12:43:47 -0500 )edit
1

answered 2014-10-27 21:18:41 -0500

You're looking on the wrong site. http://stackoverflow.com/questions/16...

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Careers

Question Tools

1 follower

Stats

Asked: 2014-10-27 21:13:24 -0500

Seen: 882 times

Last updated: Oct 29 '14