473,396 Members | 1,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to start a program/process at system startup in c#?

Hi...
I want some help in registry editing Actually i am using this code

Expand|Select|Wrap|Line Numbers
  1. namespace ConsoleApplication2
  2. {
  3.     class Win_start
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.             RegistryKey rk = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
  8.  
  9.             rk.SetValue("a", Process.Start("c:/test.pdf"));
  10.         }
  11.     }
  12. }
  13.  
It works well when i run the application from visual studio but it does not works when system starts. however it set registry well.

Thanks
Dec 6 '10 #1
1 2175
Aimee Bailey
197 Expert 100+
perhaps its not understanding how to open a pdf on start. You could use the fully qualified name instead...

Expand|Select|Wrap|Line Numbers
  1.             rk.SetValue("a", Process.Start(string.Format("\"{0}\" \"{1}\"",
  2.                                            @"C:\Program Files (x86)\Adobe\Reader 9.0\Reader\AcroRd32.exe",
  3.                                            @"c:\test.pdf")));
  4.  
Note im running 64bit, so my Program Files folder with adobe reader in has an (x86) after the name.
Dec 9 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: serge calderara | last post by:
Dear all, I have an application which is suppose to start another executable process. As soon as that process is running, I need to retrive its handle. The problem of the particular process I am...
1
by: Raj | last post by:
what I want to do is start a process in a windows system (2000/XP) at the system startup without the user having to login. I know the best option for this is to write the app as a service. I tried...
3
by: Timothy Shih | last post by:
Hi, I am trying to start a process from inside a .NET service. The process is a simple GUI app, the service will start up the GUI and then stop itself. The service starts the app, but no GUI...
2
by: DJMonte | last post by:
I have a C# program that is scheduled to run at system startup. When a user logs into the machine, how can I show a status screen of the running application? I tried with a NotifyIcon but the icon...
8
by: ZhangZQ | last post by:
How to make the Windows to run a console program during OS startup, like the Chkdsk program to do when the OS does not shutdown properly? Now I want to run my program instead of Chkdsk during the...
3
by: Thomas Wenzl [MVP] | last post by:
Hello, Initial situation: - ASP.NET application. - Users upload a file - that file has to be converted into another file format using a unmanged application that uses a lot of COM components ...
4
by: Larry | last post by:
I have a Perl script using DBD::DB2, that runs during system startup on a Solaris system. The script is working fine during startup on many machines, except on one machine it fails complaining...
1
by: UJ | last post by:
How can I add a program to the startup group for all users programmatically? TIA - J.
1
by: mikem76 | last post by:
Is there a way to get the process id when starting a process using os.popen2 or os.popen3 on linux? Mike
1
by: fatima.issawi | last post by:
Hello, I am trying to start a process which will zip a file using a command line utility from my webpage. I don't have any problems starting the process (on my development machine, anyway), but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...

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.