473,326 Members | 2,182 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,326 software developers and data experts.

System.Diagnostics.Process.Start

I am trying to open folders on different servers using System.Diagnostics.Process.Start method. Some folders are opening but others are giving me error that unknown user name and password. Is there a way I can pass user id and password to this method so it can open folder for me. Lets say my user id is "abc123" and password is "password".
Thanks in advance
May 30 '08 #1
5 1330
Plater
7,872 Expert 4TB
Check the ProcessStartInfo object, it appears to have places were credentials can be supplied.
May 30 '08 #2
Check the ProcessStartInfo object, it appears to have places were credentials can be supplied.
I am not sure what you meant. If you could please give me an example then it will be nice.
Thanks
May 30 '08 #3
Curtis Rutland
3,256 Expert 2GB
I am not sure what you meant. If you could please give me an example then it will be nice.
Thanks
You should try to look things up for yourself as well. Did you even google it?

It's not too hard:
Expand|Select|Wrap|Line Numbers
  1. using System.Diagnostics;
  2. .
  3. .
  4. .
  5. ProcessStartInfo psi = new ProcessStartInfo("path to executable here");
  6. psi.UserName = "username";
  7. string p = "password";
  8. char[] ch = p.ToCharArray();
  9. foreach(char c in ch)
  10.   s.AppendChar(c);
  11. psi.Password = s;
  12. Process.Start(psi);
  13.  
You should learn to use IntelliSense. It's the popup in Visual Studio that suggests/autofinishes code for you. Type in an object and then a period, and it will show you its methods and members. I've learned more by scrolling through that popup than I have from anything else.

For example, I'd never heard of a SecureString before I tried this. But using IntelliSensee, I figured it out without having to go to the internet. It's a good trick to know.
May 30 '08 #4
You should try to look things up for yourself as well. Did you even google it?

It's not too hard:
Expand|Select|Wrap|Line Numbers
  1. using System.Diagnostics;
  2. .
  3. .
  4. .
  5. ProcessStartInfo psi = new ProcessStartInfo("path to executable here");
  6. psi.UserName = "username";
  7. string p = "password";
  8. char[] ch = p.ToCharArray();
  9. foreach(char c in ch)
  10.   s.AppendChar(c);
  11. psi.Password = s;
  12. Process.Start(psi);
  13.  
You should learn to use IntelliSense. It's the popup in Visual Studio that suggests/autofinishes code for you. Type in an object and then a period, and it will show you its methods and members. I've learned more by scrolling through that popup than I have from anything else.

For example, I'd never heard of a SecureString before I tried this. But using IntelliSensee, I figured it out without having to go to the internet. It's a good trick to know.
Thanks man! I will definitely use your advice.
May 30 '08 #5
Curtis Rutland
3,256 Expert 2GB
Thanks man! I will definitely use your advice.
Oops, just so you know, I missed a piece of code there that you might need:
[code]
.
.
//just insert this line
System.Security.SecureString s = new System.Security.SecureString();
//above this line
string p = "password";
.
.
.
May 30 '08 #6

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

Similar topics

0
by: Daniel Reber | last post by:
I am trying to start a process from a windows service but when the process starts the command window that the process runs in never shows. Is this because I am calling it from a windows service? ...
0
by: marccruz | last post by:
Given an instance of System.Diagnostics.Process, how can I get the parent process o Given an instance of System.Diagnostics.Process, how can I get the child processes For example, I start a...
1
by: solex | last post by:
Hello All, Hopefully someone has run into this error. I have written a class(source below) that launches a thread to monitor the StandardOutput of a System.Diagnostics.Process, in particular I...
2
by: andreas | last post by:
hi, In windows xp in the start launch menu when i put notepad "c:\test.txt" i get notepad with test.txt in it. in vb.net when i state system.diagnostics.process.start("notepad.exe" i get...
11
by: Nurit N | last post by:
This is the third newsgroup that I'm posting my problem. I'm sorry for the multiple posts but the matter becoming urgent. I hope this is the right place for it... I have created a very...
2
by: Daniel | last post by:
System.Diagnostics.Process.Start fails on windows server 2003 the process returns process.ExitCode == 0 but executing any process with System.Diagnostics.Process.Start on windows xp works fine....
0
by: Daniel | last post by:
C# windows service freezes on System.Diagnostics.Process.Start(info) When I launch PSCP from a C# windows service and launch pscp 0.53 there are no issues. but when I use C# windows service to...
0
by: Colin Williams | last post by:
I am using the code below to map network drive and then fire up an app in a sub dir of that drive. However when using the file open dialog from that app, drive K: appears just as Network drive K:...
2
by: test3 | last post by:
Hello folks, I'm using System.Diagnostics.Process to start a thirdparty program (that works perfectly when started via command line). I'm using Process.StandardOutput to get the output of the...
6
by: kimiraikkonen | last post by:
Hello, I want to ask this: If i do: System.Diagnostics.Process.Start("c:\lame", "--preset standard c:\blabla.wav c:\blabla.mp3") it works. But i don't want this. I want my 2 textboxes must...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.