Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 342
  • Last Modified:

C# code to start a program

I have a program that I am making in C#. Part of the program needs to check if a process is running and, if it is not, start it. I got it to work fine with the process that it needs to start is on the local machine, but it needs to start the process from a network drive and that is not working. Here is what I have right now for it to start the program:

Process.Start(@"\\Cmn-It-maakes\C$\Testing\NOTEPAD.EXE");

That crashes out with the error: No network provider accepted the given network path

What do I need to do?

Thanks
0
wiggy353
Asked:
wiggy353
  • 4
  • 3
1 Solution
 
jason987Commented:
'c$' is the administrative share.  Try creating a regular share and/or mapping.
0
 
wiggy353Author Commented:
I can't that is the share that I am told it has to be in. Is there a way to make it work using that share?
0
 
jason987Commented:
Can't you map the share first using the proper credentials?  

net use SERVERNAME\IPC$ /user:USERNAME PASSWORD
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
wiggy353Author Commented:
It would make sense to do that, wouldn't it? Unfortunately, I cannot convince the users of that computer to do so. Can I write the code to include login information like with netinfo or something?
0
 
wiggy353Author Commented:
From what I am finding, I can use the StartInfo.username and startinfo.password to do this, but I can't figure out the correct syntax...
0
 
jason987Commented:
Those are who you are going to be running the process as not the network credentials.
0
 
wiggy353Author Commented:
I think I convinced them to just map the drive.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now