#21371 - 2002-05-08 07:34 PM
WriteValue with quotes
|
Darren Burke
Lurker
Registered: 2002-05-08
Posts: 3
|
I am trying to write a value that contains quotes. How do I do this. I tried a variet of double quotes, single quotes, etc... but cannot get it to work.
The value I am looking at is "%1" %*. Sircam messed it up on some machines and now I want to check all PCs to see if it is the correct entry and if not make the change.
As you can see from my code the quotes end up all over the place and it does not work:--
$Key = "HKLM\Software\CLASSES\exefile\shell\open\command" $Value = "" $Read = ReadValue($Key,$Value) If $Read <> ""%1" %*" $Write = WriteValue($Key,$Value,""%1" %*","REG_SZ") ENDIF sleep 2
|
|
Top
|
|
|
|
#21372 - 2002-05-08 08:00 PM
Re: WriteValue with quotes
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Is this what you're looking for? code:
$Key = "HKLM\Software\CLASSES\exefile\shell\open\command" $Value = "" $Read = ReadValue($Key,$Value) If $Read <> '"%1" %*' $Write = WriteValue($Key,$Value,'"%1" %*',"REG_SZ") ENDIF sleep 2
|
|
Top
|
|
|
|
#21373 - 2002-05-08 08:42 PM
Re: WriteValue with quotes
|
Darren Burke
Lurker
Registered: 2002-05-08
Posts: 3
|
that does not work. When I do the single quotes I get the value set to "*
|
|
Top
|
|
|
|
#21374 - 2002-05-08 08:58 PM
Re: WriteValue with quotes
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Darren,
What about the inverse of what Howard wrote?
code:
$Key = "HKLM\Software\CLASSES\exefile\shell\open\command" $Value = "" $Read = ReadValue($Key,$Value) If $Read <> "'%1' %*" $Write = WriteValue($Key,$Value, "'%1' %*","REG_SZ") ENDIF sleep 2
HTH,
- Kent
|
|
Top
|
|
|
|
#21375 - 2002-05-08 09:08 PM
Re: WriteValue with quotes
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Sorry, I should have tested it.
$Write = WriteValue($Key,$Value,Chr(34)+ "%1" + Chr(34)+ " %*","REG_SZ")
|
|
Top
|
|
|
|
#21376 - 2002-05-08 09:44 PM
Re: WriteValue with quotes
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
Here is my stab at is:
test.kix
code:
$KEY = "HKLM\Software\CLASSES\exefile\shell\open\command" $LINE = CHR(34) + "%1" + CHR(34) + " %*" $READ=READVALUE($KEY,"") IF $READ <> $LINE WRITEVALUE($KEY,"",$LINE,"REG_SZ") ENDIF
Brian
|
|
Top
|
|
|
|
#21378 - 2002-05-09 12:32 AM
Re: WriteValue with quotes
|
Darren Burke
Lurker
Registered: 2002-05-08
Posts: 3
|
Howard Bullock/ Brian TX
Thank you - It is now working. The code I used is
$Key = "HKLM\Software\CLASSES\exefile\shell\open\command" $Value = "" $LINE = CHR(34) + "%1" + CHR(34) + " %*" $Read = ReadValue($Key,$Value) If $Read <> $LINE $Write = WriteValue($Key,$Value,Chr(34)+ "%1" + Chr(34)+ " %*","REG_SZ") ENDIF
- I tried every variet of quotes/double quotes/etc... and none of those worked.
Thank you again
Darren
PS - Kix Rocks!
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 869 anonymous users online.
|
|
|