473,941 Members | 3,614 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

vb.net - RunOnce key not executing at startup

I am new to coding in vb.net and I am trying to add a registry value in
the runonce key. The key is added correctly, as I can see it when
going directly into the registry after executing my code, but when I
reboot, the value (aka the .cmd file) is not executed and the string
value is not deleted from the registry (at
HKLM\Software\M icrosoft\Window s\CurrentVersio n\RunOnce).
Here is the code I am using to create the key:
Dim key As Microsoft.Win32 .RegistryKey =
Microsoft.Win32 .Registry.Local Machine.OpenSub Key("SOFTWARE\M icrosoft\Window s\CurrentVersio n\RunOnce",
True)
key.SetValue("M WAClean", "c:\sma\mwaclea n\mwaclean.cmd" )

Is there something wrong with the code I'm using to create the key that
is not allowing XP to see it on startup...or is there something else
going on here with windows????

Any help will be greatly appreciated,

Luke

Dec 14 '06 #1
3 7169
Try putting the execution of the .cmd in a .bat file and add that to the
registry RunOnce.
That way you can debug the batch file when the system reboots by using echo
commands.

<lu********@gma il.comwrote in message
news:11******** *************@7 3g2000cwn.googl egroups.com...
>I am new to coding in vb.net and I am trying to add a registry value in
the runonce key. The key is added correctly, as I can see it when
going directly into the registry after executing my code, but when I
reboot, the value (aka the .cmd file) is not executed and the string
value is not deleted from the registry (at
HKLM\Software\M icrosoft\Window s\CurrentVersio n\RunOnce).
Here is the code I am using to create the key:
Dim key As Microsoft.Win32 .RegistryKey =
Microsoft.Win32 .Registry.Local Machine.OpenSub Key("SOFTWARE\M icrosoft\Window s\CurrentVersio n\RunOnce",
True)
key.SetValue("M WAClean", "c:\sma\mwaclea n\mwaclean.cmd" )

Is there something wrong with the code I'm using to create the key that
is not allowing XP to see it on startup...or is there something else
going on here with windows????

Any help will be greatly appreciated,

Luke

Dec 14 '06 #2
Jon


I have it on good authority that <lu********@gma il.comsaid in
news:11******** *************@7 3g2000cwn.googl egroups.com...
>I am new to coding in vb.net and I am trying to add a registry value in
the runonce key. The key is added correctly, as I can see it when
going directly into the registry after executing my code, but when I
reboot, the value (aka the .cmd file) is not executed and the string
value is not deleted from the registry (at
HKLM\Software\M icrosoft\Window s\CurrentVersio n\RunOnce).
Here is the code I am using to create the key:
Dim key As Microsoft.Win32 .RegistryKey =
Microsoft.Win32 .Registry.Local Machine.OpenSub Key("SOFTWARE\M icrosoft\Window s\CurrentVersio n\RunOnce",
True)
key.SetValue("M WAClean", "c:\sma\mwaclea n\mwaclean.cmd" )

Is there something wrong with the code I'm using to create the key that
is not allowing XP to see it on startup...or is there something else
going on here with windows????

Any help will be greatly appreciated,

Luke
You've pretty much established that your vb.net code is ok.

You may need to include a link to cmd.exe or %comspec% to precede your
command string.

--
Jon

Dec 14 '06 #3
Debugging got me going in the right direction...jus t an error in the
batch file.
Thanks for your help
NewScience wrote:
Try putting the execution of the .cmd in a .bat file and add that to the
registry RunOnce.
That way you can debug the batch file when the system reboots by using echo
commands.
Dec 14 '06 #4

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

Similar topics

4
1442
by: Yoni Gibbs | last post by:
Hi, Once an assembly has been downloaded into the GAC, is it possible to execute it locally somehow? e.g. if I download an exe into the GAC, can the client PC simply run this assembly directly, rather than going back to the URL that it downloaded the assembly from? Additionally, is there a way to execute local assemblies on startup? Thanks in advance,
1
3128
by: Dmitri Shvetsov | last post by:
Hi, My C# application works under administrative account but can't write to: HKML\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce What can I do to write there? Dmitri
15
2161
by: Chakkaradeep | last post by:
Hi all, i have written a Service,now i want to execute another application (for eg;calc.exe) in the service....how will i perform it??... i tried using this.... /**************Executing a Process code starts here**************/ System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents=false;
2
1205
by: Anthony Nystrom | last post by:
I need to exceute a method in a form from another form... Both forms will always be open so I don't have to worry about that... I just need to call the method... Please help... Source please...
0
1475
by: Bruceneedshelp | last post by:
My application starts logging and executes shell commands on startup. The application runs fine, except when it executes at boot time. In other words when I make it a "startup" application on my Windows XP box, it does everything except logging and shell commands. If I execute the application after Windows XP boots up, then it runs just fine. It seems as if the app is not getting its inherited functionality at boot time. Any help is...
2
985
by: Pete Vickers [MVP] | last post by:
Hi, I have a project, that doesn't appear to process frmMain at all - I break at form_load, and nothing happens. The form shows, but has done no processing in the form load. I have tried having frmMain as my startup object, and also Dim frmy As New frmMain frmy.ShowDialog() But my frmMain appears, without going thru the form_load.
8
3140
by: lovecreatesbea... | last post by:
K&R 2, sec 2.4 says: If the variable in question is not automatic, the initialization is done once only, conceptually before the program starts executing, ... . "Non-automatic variables are initialized before the program starts executing." -- What does this mean? What is the name of the stage in which the mentioned initialization is performed? Compile-time or run-time? In the following snippet, variables b and c are defined at line 7...
0
890
by: IanB | last post by:
I've just installed IE7 as part of Windows Update on this computer (Compaq AMD64X2 4200+ 2Gb) but it will not run the opening link: http://runonce.msn.com/runonce2.aspx just leaving me with a blank blue page and an "!" in the bottom left and "Done". Therefore, the initial configuration is not working and it keeps returning to this page when I start up. Can someone give me an alternative to allow me to configure the Windows Live setup...
3
1840
by: amolbehl | last post by:
Hi, I have a written 2 VB programs, "startup.exe" and a "mainProgram.vbp" now I need to invoke the "startup.exe" via mainProgram.vbp and send a parameter to the startup.exe as well. Does anyone know how to do this in VB6.0
0
10134
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
11530
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
11295
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
10659
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...
1
8218
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7389
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6079
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4908
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
3
3506
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.