How can I get the value of a registry key from within a batch script?

This works for me: @echo OFF setlocal ENABLEEXTENSIONS set KEY_NAME=”HKEY_CURRENT_USER\Software\Microsoft\Command Processor” set VALUE_NAME=DefaultColor FOR /F “usebackq skip=4 tokens=1-3” %%A IN (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul`) DO ( set ValueName=%%A set ValueType=%%B set ValueValue=%%C ) if defined ValueName ( @echo Value Name = %ValueName% @echo Value Type = %ValueType% @echo Value Value = %ValueValue% ) … Read more

How to delete a registry value in C#

To delete the value set in your question: string keyName = @”Software\Microsoft\Windows\CurrentVersion\Run”; using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyName, true)) { if (key == null) { // Key doesn’t exist. Do whatever you want to handle // this case } else { key.DeleteValue(“MyApp”); } } Look at the docs for Registry.CurrentUser, RegistryKey.OpenSubKey and RegistryKey.DeleteValue for more info.

Hand Install of 64-bit MS Access ODBC drivers when 32-bit Office is present

using the /passive switch you can install 64-bit ace drivers even if 32-bit ms office is present: http://blog.codefluententities.com/2011/01/20/microsoft-access-database-engine-2010-redistributable/ Just be warned that installing the 2010 64-bit ACE engine on a machine with 2010 32-bit Office already installed CAN lead to some wacky behavior in your already existing Office 2010.

Programmatically Set Browser Proxy Settings in C#

This depends somewhat on your exact needs. If you are writing a C# app and simply want to set the default proxy settings that your app will use, use the class System.Net.GlobalProxySelection (http://msdn.microsoft.com/en-us/library/system.net.globalproxyselection.aspx). You can also set the proxy for any particular connection with System.Net.WebProxy (http://msdn.microsoft.com/en-us/library/system.net.webproxy.aspx). If you actually want to update the proxy settings … Read more

Use registry to startup a program, and also change the current working directory?

You can register your application under next registry key (like this does Reg2Run tool) HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\example.exe @=”c:\example\example.exe” Path=”c:\AnotherPath” So System.Diagnostics.Run(“example.exe”); will launch your application with specified working path. Or another way: write a launcher using C#. You can do the same using a PowerShell cmdlet. var info = new System.Diagnostics.ProcessStartInfo(@”c:\example\example.exe”, “-someargument”) { WorkingDirectory = @”c:\AnotherPath” … Read more

Web browser control emulation issue (FEATURE_BROWSER_EMULATION)

Below is my WebBrowser playground application (in C#) which works well with your URL (http://demos.dojotoolkit.org/demos/calendar/demo.html). Disabling FEATURE_NINPUT_LEGACY_MODE is what made the difference, I believe. There is a couple of other settings I enabled, as well. It also shows how to use HKEY_CURRENT_USER instead of HKLM, so the app doesn’t require admin rights. using Microsoft.Win32; using … Read more