Archive for April, 2012

Creating scheduled tasks with schtasks.exe on Windows 7

Tuesday, April 24th, 2012

In Windows 7, it’s easy to create scheduled tasks. You can either use Task Scheduler under Programs -> Accessories -> System Tools or you can use schtasks.exe in the cmd. schtasks.exe can be scripted and most of the commands and options that are available in Task Scheduler are also available in schtasks.exe

In my particular case, I wanted to create a task that runs EVERYDAY in a 5 MINUTE INTERVAL from 07:00 to 21:30. Although schtasks.exe provides some examples, I promptly chose the wrong example to edit and whatever I tried didn’t seem to work.

After a lot of fiddling and calling up a good friend’s advice, this command line did the trick (should all be on one line):

schtasks /create /ru “system” /sc daily  /tn “your task name” /tr “‘%programfiles%\path\to\your\executable.exe'” /st 07:05 /sd 01/01/2012 /du 14:30 /ri 10 /f

What does this do?

Start a cmd as administrator and the above command line will create a task called “your task name”.
The task will be created and run:
-in system context (ru = run as user)
-daily from 07:05 (sc = schedule, st = starting time) until 21:30 (du = duration – 14.5 hours)
-in a 10 minute interval (ri = run interval in minutes)
-using the provided executable (tr = taskrun). Note that you can use environment variables that have to be escaped using single quotes.
-forcing the task e.g. if a task with the same name already exists, it will be overwritten

Where did I go wrong:

The help in schtasks provides some examples. My mistake was the following though:
If you choose /sc minute, you’re stuck on one particular day because you have to provide a /st and an /et (end time). The end time will always default to the provided time and the day the task was created and only that day. E.g. if you create a task running from /st 07:00 to /et 14:00, schtasks.exe will translate this to “from 07:00 <today> to 14:00 <today>” and only run it on that particular day and then never again.

Notable absent option in schtasks.exe:
In the Task Scheduler gui, a task can be created/optimized for Vista/W2k8 or Win7/W2k8_R2.
This options changes the tag “Task version” from version=”1.2″ to version=”1.3″ in the XML file of that task. In schtasks.exe, this option is not available but it doesn’t seem to make a difference at all.

HTHS
m.

北京 – the funny part

Friday, April 20th, 2012

After spending a couple of days in Beijing, the sarcastic 外国人 in me started showing through again. I’ll demonstrate showing you some pictures, all of which were taken on 王府进大街 (Wangfujin Avenue, a big shopping street).

1) Directions?

If you have ever heard of “CHINES ECR EATURE” or “PHOTOG RA PHIC EQU IP MENT”, please raise your hand. And if you need a wrapping service for your presents, please go see the “THE BOX WRAPPER HAS”.

2)  The perfect gift for you 3 year old daughter…

You love your daughter, you have just been to 北京, why not show your love with this special t-shirt?

While you are in Beijing, the context may save you, but try wearing this t-shirt in an English-speaking speaking country in a park at night…

3) The Supermarket

Just a couple of shops down from the t-shirt store, I found this gem:

I wonder what the specialty is… probably spelling foreign words without using particular vowels. “Look, Ma! No ‘a’s!”

4) Those damned word boundaries again…

At least here, they have an explanation (well, sort of): They try to make the letters fit onto the panels. But they did a better job on 3)

5) Dictionary words, what a pain

Some words are easily recognizable, even when the spelling is incorrect. This one took me a minute and I first was thinking of “wrath”, but how can you sell that?

Only after looking at 手表, I understand that they meant “watch”. This is really pitiful… grammatical errors is one thing, but dictionary words? Also, they got the plural in handicrafts right, but will the supermarket be able to survive by selling just one watch and one shaving razor? Finally, thanks for providing a second translation of “toy”, didn’t get it the first time…

6) Ingenious parent-kid bike

Found this little germ on 北池子大街 (Beichizi Avenue), north of 天安门东站 (Tian’an men East station): an electric bike with a built-on kid’s seat. Given the traffic in Beijing, 新日 (new day) sounds more like a family prayer while riding.