How to put command with parms directly in Registry RunOnce?


Extraordinary Member
Assume I want to perform a command line command with parameters one time at next boot (under 64bit Win 7).

Therefore I want to create this command directly in the appropriate Registy key and not indirectly by
putting it into *.bat batch script and and call this from RunOnce

For simplicity assume I want to perform a "chkdsk" command but it could be others as well.

Now I have difficulties to setup a *.reg script. The following does NOT work:

"doitonce"="\"chkdsk Z: /F /V /R /I /C >C:\log\mychkdsk.log\""

What do I have to change?



Fantastic Member
Premium Supporter
Hi Peter,

Not much on Windows script command programming, but I can tell you that running Chkdsk on startup can be tricky. It first of all needs to be run in an Administrator level CMD prompt or in a SAFE MODE configuration. Chkdsk no longer runs in Standard Mode to completion on most Windows computers Vista and later due to Anti-Virus/Anti-Spyware being loaded in front of Chkdsk command and especially if your AV or AS security software is checking for Rootkits. Not sure why you want to run this, as checking for and clearing bad sectors on bootup is a thing of the past; even more so from what I understand about SSD drives work if you are using one of those with your intended command script.

Sorry that's not much help, but, what is the purpose of you issuing this command at startup?


This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.