Find root cause: RunOnce commands don't all run on my current XP machine


When using my current work notebook (with IT's configured image) with CacheMyWork, I'm unable to get most of the cached RunOnce commands to actually succeed at next logon:
  • I've found that if I cache 1-3 processes, they'll usually all run at next logon
  • When I cache the usual number of processes I like to cache (e.g. 5-10), it seems that only a few of these will start up at next logon; if memory serves, I think there have even been occasions when NONE of them startup.
  • I haven't found any particular common process that will never or always startup - but I haven't done much root cause analysis of this yet.
  • I suspect one or more of the security apps installed as part of IT's XP build are blocking these RunOnce commands (possibly thinking they're malware), but I haven't been able to figure out which one of these is responsible.
  • I've scoured the logs spewed by the security apps on my box, but haven't seen any sign of any trouble or collision the security apps have with anything that even implies a RunOnce connection (let alone any direct mention of it)
  • It turns out that the functions being called by CacheMyWork were resulting in appending a space character at the end of the Command Line being populated into the Registry
  • The space character blocks the command line from being run only when the space character appears outside of a quoted command line (e.g. "C:\Program Files\Mozilla Firefox\firefox.exe" )
  • The space character at the end of a command line is NOT a problem for Windows when (a) Windows launches the app from the Run key, (b) the space character appears inside the quotation marks (e.g. "C:\Program Files\Mozilla Firefox\firefox.exe "), or (c) it appears at the end of a non-quoted command line (e.g. c:\windows\system32\cmd.exe).
    RESOLUTION: just before populating the command line into the Registry, call the TrimEnd() function with no parameter, which will delete all space characters at the end of the String.
Closed Sep 24, 2007 at 8:44 PM by MikeSL
Fixed in v1.1.


MikeSL wrote Jul 19, 2007 at 10:34 PM

(This may provide some debugging capabilities to RunOnce commands.)

To create a detailed log file for user profiles (for debugging RUP issues):

• Start regedit and locate the following path: HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\Winlogon• Create a new value called UserEnvDebugLevel as a REG_DWORD, and set the value to 30002 in hexadecimal format.• The log file can be found at: %windir%\debug\usermode\userenv.log

wrote Sep 24, 2007 at 2:34 AM

wrote Sep 24, 2007 at 8:20 PM

wrote Sep 24, 2007 at 8:44 PM

wrote Feb 14, 2013 at 7:32 PM

wrote May 16, 2013 at 9:49 AM