6 Replies - 987 Views - Last Post: 22 January 2013 - 03:00 PM Rate Topic: -----

#1 xxxpetko  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 10-December 12

Shell doesnt run regedit

Posted 20 January 2013 - 10:42 AM

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 ?
Is This A Good Question/Topic? 0
  • +

Replies To: Shell doesnt run regedit

#2 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3334
  • View blog
  • Posts: 11,300
  • Joined: 12-December 12

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

Was This Post Helpful? 0
  • +
  • -

#3 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1046
  • View blog
  • Posts: 4,072
  • Joined: 02-July 08

Re: Shell doesnt run regedit

Posted 20 January 2013 - 01:33 PM

We have moved to the Process class.
Was This Post Helpful? 0
  • +
  • -

#4 xxxpetko  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 10-December 12

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...
Was This Post Helpful? 0
  • +
  • -

#5 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3334
  • View blog
  • Posts: 11,300
  • Joined: 12-December 12

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.

This post has been edited by andrewsw: 21 January 2013 - 12:32 PM

Was This Post Helpful? 0
  • +
  • -

#6 xxxpetko  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 10-December 12

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:
 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()


Was This Post Helpful? 0
  • +
  • -

#7 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3334
  • View blog
  • Posts: 11,300
  • Joined: 12-December 12

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..).
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1