map network drives and execute program?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: map network drives and execute program?

Hybrid View

  1. #1
    Join Date
    Dec 2010
    Posts
    11

    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 ?

  2. #2
    Join Date
    Feb 2011
    Location
    United States
    Posts
    1,006

    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.

  3. #3
    Join Date
    Dec 2010
    Posts
    11

    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center