-
March 6th, 2013, 07:58 PM
#1
map network drives and execute program?
I'm trying to write a small piece of code that disconnects two mapped drives and then remaps them. Then I want it to execute a program. I have it executing the program if it's notepad for example but not anything locate on a drive. Also how can I disconnect and map the drives?
Here is what I have:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
Process schedule = new Process();
notepad.StartInfo.FileName = "notepad.exe";
notepad.Start();
}
}
}
This launches notepad, but how would I launch something in z:\program.exe ?
-
March 6th, 2013, 09:57 PM
#2
Re: map network drives and execute program?
This launches notepad, but how would I launch something in z:\program.exe ?
I think like:
Code:
notepad.StartInfo.FileName = @"Z:\program.exe";
The @ means string literal. Instead you could have written "Z:\\program.exe"
Perhaps one of these links might be revealing:
Best Regards,
BioPhysEngr
http://blog.biophysengr.net
--
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.
-
March 7th, 2013, 07:42 AM
#3
Re: map network drives and execute program?
awesome. I'll test that. What about disconnecting and remapping drives?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|