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 ?
Re: map network drives and execute program?
Quote:
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:
Re: map network drives and execute program?
awesome. I'll test that. What about disconnecting and remapping drives?