When I type "Shell("CMD.exe"), it opens command line, but when I type "Shell("C:\Windows\regedit.exe")", it says "File not found"...I tried type "C:\Windows\regedit.exe" to Win+R window and it works, what am I doing wrong ?
Shell doesnt run regedit
Page 1 of 16 Replies - 275 Views - Last Post: 22 January 2013 - 03:00 PM
Replies To: Shell doesnt run regedit
#2
Re: Shell doesnt run regedit
Posted 20 January 2013 - 11:27 AM
Shell("regedit.exe")
Windows will find it..
This post has been edited by andrewsw: 20 January 2013 - 11:29 AM
#4
Re: Shell doesnt run regedit
Posted 21 January 2013 - 11:13 AM
Thanks, but only "regedit.exe" result to same situation...I only want write key to registri, but when I want to do it in code, it says "acces denied", but it is not comfortable to run program as administrator all the time, becouse I need write key to registri only at first run, so I tried run regedit with file as parameter but it fails too so run it as proces don't help me...
#5
Re: Shell doesnt run regedit
Posted 21 January 2013 - 12:27 PM
Process is preferred to Shell - did you refer to the link provided by _HAWK_? [I think you may have done; I couldn't interpret this from your recent post.]
You can write to the registry using either My.Computer.Registry or the Win32-API as outlined here. Personally, I would concentrate on these two methods, in this order. If I weren't able to do this for some reason I would investigate why rather than resorting to Shell. In particular, "Cannot find file" might mean "you don't have permission".
Are you using Vista and running into UAC control? Try writing to HKCU which doesn't require admin privileges.
You can write to the registry using either My.Computer.Registry or the Win32-API as outlined here. Personally, I would concentrate on these two methods, in this order. If I weren't able to do this for some reason I would investigate why rather than resorting to Shell. In particular, "Cannot find file" might mean "you don't have permission".
Are you using Vista and running into UAC control? Try writing to HKCU which doesn't require admin privileges.
This post has been edited by andrewsw: 21 January 2013 - 12:32 PM
#6
Re: Shell doesnt run regedit
Posted 22 January 2013 - 05:39 AM
I have Windows8.
I tried to write key to HKCU and that's working, but when I want write key to other place, it throws:
"An unhandled exception of type 'System.Security.SecurityException' occurred in mscorlib.dll
Additional information: Požadovaný přístup k registru není povolen."
So, Can I get administrator privileges for some time ? It's needed only at first run of application.
Here is code:
I tried to write key to HKCU and that's working, but when I want write key to other place, it throws:
"An unhandled exception of type 'System.Security.SecurityException' occurred in mscorlib.dll
Additional information: Požadovaný přístup k registru není povolen."
So, Can I get administrator privileges for some time ? It's needed only at first run of application.
Here is code:
Dim regKey As Microsoft.Win32.RegistryKey
regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", True)
regKey.SetValue("My App.vshost.exe", "8888")
regKey.Close()
#7
Re: Shell doesnt run regedit
Posted 22 January 2013 - 03:00 PM
This is the nearest relevant link to this topic I could find.
I would also spend some time searching Stack Overflow. If you decide to post a question on SO (if you don't get a further response here) then I would advise you to do a thorough search firstly! People will bark at you if you post a question that has already been asked (or a silly question, ..or if you don't explain it clearly..).
I would also spend some time searching Stack Overflow. If you decide to post a question on SO (if you don't get a further response here) then I would advise you to do a thorough search firstly! People will bark at you if you post a question that has already been asked (or a silly question, ..or if you don't explain it clearly..).
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|