简体   繁体   中英

Invoking “cmd.exe” and change “cd” to directory on mapped drive from C# app

  1. VS_2010 is development tool.
  2. I'm developing C# app that need to do the following: 2a. Invoke "cmd.exe" 2b. Change directory. 2c. Start "someApp.exe".

I know how to do 2a. I know how to do 2b. I know how to do 2c.

I do NOT know how to do 2b when I need to change directory to one located on network ( Mapped Drive Y::\\aaaa\\bbbb\\cccc).

Could anybody help ?

thanks

You can't change directory to a mapped drive. What you can do is just set the working directory to that drive in a Process object. If 2a is just a means to an end, this will solve your problem:

var proc = new Process();
proc.StartInfo.FileName = "someApp.exe";
proc.StartInfo.WorkingDirectory = @"Y:\aaaa\bbbb\cccc";
proc.Start();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM