comment inside a reg key's string value?

H

Harry Davis

Hello,

I am using a string value in

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run

to control whether a program starts at boot.

Is it possible and safe to comment the value data in and out, e.g. to have

"C:\Path\program.exe"

as the data, and then, when not wanting the program to start at next boot,
putting in a ";", i.e. changing the date to

;"C:\Path\program.exe"

?

Or maybe there is a better way to do this, requiring equally little typing?

Thanks in advance!

Harry
 
V

VanguardLH

Harry Davis said:
I am using a string value in

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run

to control whether a program starts at boot.

Is it possible and safe to comment the value data in and out, e.g. to have

"C:\Path\program.exe"

as the data, and then, when not wanting the program to start at next boot,
putting in a ";", i.e. changing the date to

;"C:\Path\program.exe"

?

Or maybe there is a better way to do this, requiring equally little typing?

Why not just use the msconfig.exe utility already provided in Windows to
enable/disable startup items?
 
H

Harry Davis

VanguardLH said:
Why not just use the msconfig.exe utility already provided in Windows
to enable/disable startup items?

Thanks for this suggestion, which I may use. For the record, typing "-",
without the inverted commas, before the path in the value data seems to
disable the program from starting at boot. Curiously, when it does that,
the program still shows up as enabled in msconfig.

Harry
 
H

Harry Davis

That's because you are introducing a syntax error where the FQNP is
not interpreted and the file is subsequently not executed. To
MSCONFIG nothing has changed. All you have done is introduce a bug
the blocks an entry's execution. In effect, you are mucking with the
Registry and this is contraindicated. If you don't know and fully
understand what you are doing in the Registry then you should not be
modifying it.

Thanks for this. Isn't one person's commenting out, which achieves the
desired goal and doesn't have any ill effects, another person's syntax
error here, though? :)

It seems standard to put "-" in the value data, so presumably nothing
after the "-" is looked at? I.e. straightforward commenting out? I should
be congratulated for working this one out, surely? :)

Harry
 
D

David H. Lipman

From: "Harry Davis said:
Thanks for this. Isn't one person's commenting out, which achieves the
desired goal and doesn't have any ill effects, another person's syntax
error here, though? :)

It seems standard to put "-" in the value data, so presumably nothing
after the "-" is looked at? I.e. straightforward commenting out? I should
be congratulated for working this one out, surely? :)

Harry

No. You should not be congratulated for "mucking" with the Registry and you have not
commenting out the string.

A string that is identified to be a comment is ignored and is only meant for human
interpretation.

A string with a syntax error is interpreted by the OS but fails to work as expected
because of the introduced error. Editing the Registry to achieve such actions can and may
lead to unintended, negative, consequences.
 
V

VanguardLH

Harry Davis said:
Thanks for this suggestion, which I may use. For the record, typing "-",
without the inverted commas, before the path in the value data seems to
disable the program from starting at boot. Curiously, when it does that,
the program still shows up as enabled in msconfig.

msconfig, SysInternal's AutoRuns, and other similar utilities that
"disable" items do so by MOVING them out of the normal startup location
and hiding them in a storage key reserved by the utility to hold the old
entries. When you disable, you MOVE the startup item to this holding
area. When you later re-enable an item, you MOVE it from the holding
area back to its normal startup location. Only if you use the config
utility to delete a startup item (not available in msconfig) does the
item actually wholly disappear from the registry.

Anything that makes impossible finding the target of a startup item will
work, as you've noticed. You could rename the folder where resides the
executable file. You could rename file.exe to file.exx in the startup
item. You could change "C:\file.exe" to "?:\file.exe". You are
introducing an error in the parser that tries to determine what to run
(which is the executable and which are parameters to the program).

Have you tried rebooting Windows to ensure that you don't get some popup
telling you that the startup item could not be found? Or some
mysterious instance of Windows Explorer loads when you login? Stick
with moving out the items you want to disable (and moving them back when
you want to re-enable), like using msconfig, AutoRuns, or another
startup tweaker.
 
G

glee

Harry Davis said:
Thanks for this. Isn't one person's commenting out, which achieves the
desired goal and doesn't have any ill effects, another person's syntax
error here, though? :)

It seems standard to put "-" in the value data, so presumably nothing
after the "-" is looked at? I.e. straightforward commenting out? I
should
be congratulated for working this one out, surely? :)


LOL.... you haven't "discovered" anything new. Using the "-" has been a
standard since it was "discovered" nearly 15 years ago, and has been
documented ever since.

Congratulations on stumbling upon something you could have learned
through a web search much faster!
;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top