473,394 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

using RegistryKey to get he value from the registry

I am using
RegistryKey reademai2 = Registry.LocalMachine.OpenSubKey(launch_email_path ,
true);
string launch_email = (String)reademai2.GetValue("");
To get the value, in the registry, value = "C:\Program Files\Internet
Explorer\iexplore.exe" -nohome
but If I used string launch_email = (String)reademai2.GetValue("");
I got the value ="\"C:\Program Files\Internet Explorer\iexplore.exe\" -nohome"

System will add "\......\", is it normal?
Nov 16 '05 #1
8 2810
On Fri, 10 Dec 2004 10:21:01 -0800, Steve wrote:
I am using
RegistryKey reademai2 = Registry.LocalMachine.OpenSubKey(launch_email_path ,
true);
string launch_email = (String)reademai2.GetValue("");
To get the value, in the registry, value = "C:\Program Files\Internet
Explorer\iexplore.exe" -nohome
but If I used string launch_email = (String)reademai2.GetValue("");
I got the value ="\"C:\Program Files\Internet Explorer\iexplore.exe\" -nohome"

System will add "\......\", is it normal?


Those are just escape characters for the quotes in the string. It is
normal.
--
Tom Porterfield
Nov 16 '05 #2
Is there any way I can remove the escape character automatically or I need to
remove manually, for I will launch the string, if have the escape character,
will cause error.

"Tom Porterfield" wrote:
On Fri, 10 Dec 2004 10:21:01 -0800, Steve wrote:
I am using
RegistryKey reademai2 = Registry.LocalMachine.OpenSubKey(launch_email_path ,
true);
string launch_email = (String)reademai2.GetValue("");
To get the value, in the registry, value = "C:\Program Files\Internet
Explorer\iexplore.exe" -nohome
but If I used string launch_email = (String)reademai2.GetValue("");
I got the value ="\"C:\Program Files\Internet Explorer\iexplore.exe\" -nohome"

System will add "\......\", is it normal?


Those are just escape characters for the quotes in the string. It is
normal.
--
Tom Porterfield

Nov 16 '05 #3
On Fri, 10 Dec 2004 11:15:01 -0800, Steve wrote:
Is there any way I can remove the escape character automatically or I need to
remove manually, for I will launch the string, if have the escape character,
will cause error.


How are you launching the process? The escape characters should not cause
a problem.
--
Tom Porterfield
Nov 16 '05 #4
I used System.Diagnostics.Process.Start(launch_iexplorer) ; launch_iexplorer
base on the value in registry

"Tom Porterfield" wrote:
On Fri, 10 Dec 2004 11:15:01 -0800, Steve wrote:
Is there any way I can remove the escape character automatically or I need to
remove manually, for I will launch the string, if have the escape character,
will cause error.


How are you launching the process? The escape characters should not cause
a problem.
--
Tom Porterfield

Nov 16 '05 #5
On Fri, 10 Dec 2004 11:57:02 -0800, Steve wrote:
I used System.Diagnostics.Process.Start(launch_iexplorer) ; launch_iexplorer
base on the value in registry


Then I suspect it is the -nohome parameter that is causing the problem. If
you remove that does it work? You need to use a ProcessStartInfo object
that allows you to set separately the file to start and the arguments to
pass to the file.
--
Tom Porterfield
Nov 16 '05 #6
My system is XP sp2, I tried
"\"C:\\Program Files\\Internet Explorer\\iexplore.exe\"" from Start->Run,
system show error message, but if run
"C:\\Program Files\\Internet Explorer\\iexplore.exe" system can launch
internet explorer without any program

"Tom Porterfield" wrote:
On Fri, 10 Dec 2004 11:57:02 -0800, Steve wrote:
I used System.Diagnostics.Process.Start(launch_iexplorer) ; launch_iexplorer
base on the value in registry


Then I suspect it is the -nohome parameter that is causing the problem. If
you remove that does it work? You need to use a ProcessStartInfo object
that allows you to set separately the file to start and the arguments to
pass to the file.
--
Tom Porterfield

Nov 16 '05 #7
On Fri, 10 Dec 2004 13:31:02 -0800, Steve wrote:
My system is XP sp2, I tried
"\"C:\\Program Files\\Internet Explorer\\iexplore.exe\"" from Start->Run,
system show error message, but if run
"C:\\Program Files\\Internet Explorer\\iexplore.exe" system can launch
internet explorer without any program


From start,run it won't work as that doesn't use the C# language to
interpret the string. But if you are calling Process.Start in a C#
program, which is what I thought you said you were trying to do, the escape
characters will be handled properly.
--
Tom Porterfield
Nov 16 '05 #8
Tom,

You are right, it works from c#, thanks a lot.

B. RGDS
Steve

"Tom Porterfield" wrote:
On Fri, 10 Dec 2004 13:31:02 -0800, Steve wrote:
My system is XP sp2, I tried
"\"C:\\Program Files\\Internet Explorer\\iexplore.exe\"" from Start->Run,
system show error message, but if run
"C:\\Program Files\\Internet Explorer\\iexplore.exe" system can launch
internet explorer without any program


From start,run it won't work as that doesn't use the C# language to
interpret the string. But if you are calling Process.Start in a C#
program, which is what I thought you said you were trying to do, the escape
characters will be handled properly.
--
Tom Porterfield

Nov 16 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Bob | last post by:
I'm working on a Windows app that needs to write to the Registry HKLM. I keep getting a "System.UnauthorizedAccessException: Cannot write to the registry key." error when running the app. I'm...
0
by: csharp_helpwanted | last post by:
steps.. first, I'm creating a connection by mapping a network drive to the pc second, the map drive connection was successful I try to read a certian registry key/value (that is a valid reg...
1
by: Wm. Scott Miller | last post by:
I have a Custom DTS Task for SQL Server and I've got it working fine, except for when I try to access its properties from an ActiveX script. I have added a new property called Length and a method...
0
by: g82martin | last post by:
I am using the RegistryKey class to access the registry on remote machines. I only require read access. I am able to successfully read registry keys under HKLM\Software\Microsoft\Windows...
2
by: Chakkaradeep | last post by:
Hi all, heres my code, *******//////////////////////Starts Here////////////////////////////////////********* try { RegistryKey rKey =...
4
by: Thomas | last post by:
Hi All, When i am trying run the following code i am geting the error 'Object reference not set to an instance of an object' Try Dim Reg As RegistryKey Dim Value As String Dim KeyValue As...
1
by: JJG | last post by:
Hello. I'm not sure if this is the right forum, so please let me know what is the correct one if it isn't. (I posted this one also to the win32.programmer.wmi forum). I've been puzzled by this...
4
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. Here is my problem. I have a program that will create a registry key, however it is not and here is the code and also the error that follows: ...
4
by: yxq | last post by:
Hello, I want to get the registry key permission information whether current user has the permission to delete the registry key using RegistryRights, how to do? thank you.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.