473,806 Members | 2,219 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using RegistryKey to get he value from the registry

I am using
RegistryKey reademai2 = Registry.LocalM achine.OpenSubK ey(launch_email _path,
true);
string launch_email = (String)readema i2.GetValue("") ;
To get the value, in the registry, value = "C:\Program Files\Internet
Explorer\iexplo re.exe" -nohome
but If I used string launch_email = (String)readema i2.GetValue("") ;
I got the value ="\"C:\Progr am Files\Internet Explorer\iexplo re.exe\" -nohome"

System will add "\......\", is it normal?
Nov 16 '05 #1
8 2830
On Fri, 10 Dec 2004 10:21:01 -0800, Steve wrote:
I am using
RegistryKey reademai2 = Registry.LocalM achine.OpenSubK ey(launch_email _path,
true);
string launch_email = (String)readema i2.GetValue("") ;
To get the value, in the registry, value = "C:\Program Files\Internet
Explorer\iexplo re.exe" -nohome
but If I used string launch_email = (String)readema i2.GetValue("") ;
I got the value ="\"C:\Progr am Files\Internet Explorer\iexplo re.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.LocalM achine.OpenSubK ey(launch_email _path,
true);
string launch_email = (String)readema i2.GetValue("") ;
To get the value, in the registry, value = "C:\Program Files\Internet
Explorer\iexplo re.exe" -nohome
but If I used string launch_email = (String)readema i2.GetValue("") ;
I got the value ="\"C:\Progr am Files\Internet Explorer\iexplo re.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.Diagnost ics.Process.Sta rt(launch_iexpl orer); launch_iexplore r
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.Diagnost ics.Process.Sta rt(launch_iexpl orer); launch_iexplore r
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 ProcessStartInf o 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:\\Prog ram Files\\Internet Explorer\\iexpl ore.exe\"" from Start->Run,
system show error message, but if run
"C:\\Progra m Files\\Internet Explorer\\iexpl ore.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.Diagnost ics.Process.Sta rt(launch_iexpl orer); launch_iexplore r
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 ProcessStartInf o 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:\\Prog ram Files\\Internet Explorer\\iexpl ore.exe\"" from Start->Run,
system show error message, but if run
"C:\\Progra m Files\\Internet Explorer\\iexpl ore.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:\\Prog ram Files\\Internet Explorer\\iexpl ore.exe\"" from Start->Run,
system show error message, but if run
"C:\\Progra m Files\\Internet Explorer\\iexpl ore.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
14836
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 logged in as an Administrator and it's a Windows app. What permission does it need? Here's the code. private void ChangeReg() { string regPath = "SOFTWARE\\Microsoft\\.NETFramework\\AssemblyFolders"; RegistryKey thisKey = Registry.LocalMachine;
0
2855
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 item) third, I disconnect the network drive connection it works great the first time but if i run it again on the same pc anytime after that I get the following
1
2962
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 called Generate that returns a string. Whenever I get the object in the ActiveX script, the only properties and methods I can use are for the CustomTask interface, not the extended properties I've added. Does anyone know why these properties...
0
3274
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 NT\CurrentVersion\HotFix but I get a permissions error when I try to access HKLM\Software\Network Associates\TVD\Shared Components\VirusScan Engine\4.0.xx. The security permissions are identical on these two keys. Here is my code: RegistryKey...
2
5283
by: Chakkaradeep | last post by:
Hi all, heres my code, *******//////////////////////Starts Here////////////////////////////////////********* try { RegistryKey rKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\AICM\\Position",true);
4
8463
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 String = "Software\\MyCompany\\Connections" Reg = Registry.LocalMachine.OpenSubKey(KeyValue, True)
1
13381
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 a for a few days. I'm trying to read a registry value from a remote system's registry using WMI (System.Management). I'm able to connect to the system and even run a process, but I cannot figure out what is I have to do to get the StdRegProv...
4
1729
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: Imports System.IO Imports System.Text Imports System.Security.Cryptography Imports System.Net Imports Microsoft.VisualBasic.Conversion Imports System.Management
4
3234
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
9718
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10370
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10109
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4328
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3849
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.