China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-12 12:29
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Run an IE cache file cleanup script every Monday (via Group Policy) View 1,099 Replies 2
Original Poster Posted 2009-09-14 04:51 ·  中国 辽宁 大连 联通
新手上路
Credits 14
Posts 14
Joined 2009-09-08 02:40
16-year member
UID 151651
Gender Male
Status Offline
I want to make a script:
run an IE cache file cleanup script every Monday (via Group Policy)

I'd like to ask everyone: how should this code be written so it can run under power users (it works with administrator privileges, but all the PCs in our workplace are set to power user privileges)?

Also, can the AT command create a task name? (Otherwise, if the user creates one named AT1 himself, the startup script will delete it.)

The code is as follows:
@echo off
echo
schtasks /delete /tn "At1" /f (first delete the auto-created task with the AT name (AT1))
at 8:40AM /Every:Monday cmd /c del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*" (create the task named AT1)
echo
Floor 2 Posted 2009-09-14 05:55 ·  中国 吉林 延边朝鲜族自治州 延吉市 电信
银牌会员
★★★
正在学习中的菜鸟...
Credits 1,039
Posts 897
Joined 2009-03-01 15:34
17-year member
UID 140302
Gender Male
From 在地狱中仰望天堂
Status Offline
Just use schtasks to create the task, and specify the user while creating it
/ru {[Domain\]User | "System"}
Runs the task with the permissions of the specified user account. By default, it runs with the permissions of the user logged on to the computer where SchTasks is run.
Floor 3 Posted 2009-09-15 02:45 ·  中国 辽宁 大连 联通
新手上路
Credits 14
Posts 14
Joined 2009-09-08 02:40
16-year member
UID 151651
Gender Male
Status Offline
I haven't really used the schtasks command much. After writing it, I found it didn't take effect.
Also, when using schtasks to create a task, it seems you can only add a path or executable file.
Is adding this command not okay? del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\


@echo off
echo
schtasks /delete /tn "Del_ie_temp" /f first delete the task name
schtasks /create /tn "Del_ie_temp" /sc /WEEKLY /MON /st 08:30 /tr cmd /c del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*" /ru administrator /rp password11111 delete every Monday at 8:30
echo
Forum Jump: