Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Schedule ONE-TIME task with "schtasks" at next reboot?

10 Mar 2015   #1
pstein

win7pro 64bit
 
 
Schedule ONE-TIME task with "schtasks" at next reboot?

As you know users can setup a task to be run at startup with the built-in task scheduler "schtasks" with

schtasks /sc ONSTART ... /TR ...

However this command syntax triggers the task at EVERY BOOT time.
How do I setup (from command line and not through GUI!!!) a ONE-TIME task?

For simplicity lets assume I want to run chkdsk for partition E: ONCE at next reboot.

How can I achieve this with "schtasks" built-in command?

I don't want to specify a certain time because it varies from time to time and computer to computer and exacty boot time cannot be specified.

Peter


My System SpecsSystem Spec
.
10 Mar 2015   #2
Alejandro85

Windows 7 Ultimate x64
 
 

Not tried it, but quickly seeing the help I can think of two ways for that.

/Z modifier says that it marks the task for deletion after the next execution (not completely sure, but it might work for auto-deleting it after running).
Another option could be to modify the program pointed to /TR to a bat file instead. It will first run the original program and then invoke schtasks again to delete the task, effectively running it only once.

Other possibilities without involving the task scheduler could be to use the registry key specifically designed for this. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce and HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce can point to any programs that are run at login of either every user or a particular one, but then autodeleted by the system itself without further intervention required (installers sometimes drop cleanup routines to perform after reboot.
Note that the registry option is not executed at system startup, but at user login instead.
My System SpecsSystem Spec
Reply

 Schedule ONE-TIME task with "schtasks" at next reboot?




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Need to add "TASKBARS" (MSese for "Launchpads", "Docks" NOT "Toolbars"
My office just upgraded, and I can no longer use Windows XP. On this system, I was able to add a separate taskbar to facilitate quick access to commonly-browsed folder locations on our vast network, and another one expedited the launching of useful programs and lists. Each task on each taskbar...
General Discussion
W7 64bits Task Scheduler, the selected task "{0}" no longer exists
Hi, So I don't know when this: "the selected task "{0}" no longer exists. to see the current task, click refresh" error started but I don't know how to repair this. When I start task scheduler I first get this error and than no matter what folder I click the error pops up again. After this 2nd...
General Discussion
SSD won't reboot: "Reboot and select proper boot device"
Hi all, First timer, please help! My buddy and I tried building a new computer from scratch with the following: OCZ (AGT4-25SAT3-128G) Agility 4 2.5" 128GB SATA3 6GB/s Solid State Drive Kingston KHX1600C9D3B1K2/8GX 8GB Kit 2X4GB 1600MHz DDR3 240PIN DIMM Unbuff Hmp HyperX CL9 Antec Neo...
Installation & Setup
the task bar "folder" pinned "program"
I usually use it by pinning my frequently use folder, so when I right click, the list of "pinned program (folder)" will be listed out, easy for me to access them in a click. and one day, all the pinned programs gone. so I attempted to "repin" all vanish folders, but even if I click to pin...
General Discussion
Install time difference between "Upgrade" and "Custom"
Is the time to "Upgrade from vista to 7 supposed to be wayyy longer then it would to do jsut a clean install? (For example, hanging at 18% for a while while installing during upgrade) (posting this since i cant get any replies to a previous topic)
Installation & Setup


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 03:41.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App