Page 1 of 1 1
Topic Options
#21371 - 2002-05-08 07:34 PM WriteValue with quotes
Darren Burke Offline
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 Offline
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

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#21373 - 2002-05-08 08:42 PM Re: WriteValue with quotes
Darren Burke Offline
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 Offline
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
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#21375 - 2002-05-08 09:08 PM Re: WriteValue with quotes
Howard Bullock Offline
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")
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#21376 - 2002-05-08 09:44 PM Re: WriteValue with quotes
BrianTX Offline
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
#21377 - 2002-05-08 11:26 PM Re: WriteValue with quotes
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
My guess:

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

_________________________
There are two types of vessels, submarines and targets.

Top
#21378 - 2002-05-09 12:32 AM Re: WriteValue with quotes
Darren Burke Offline
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
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 641 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.058 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org