0

I need to run a batch file stored in a shared drive, this batch file needs a path of a different file as an argument. How can I specify the path of this batch file and the path of the other file in c# asp.net ?

I tried to write the path of the batch file as a string, and I got the other file from UploadFile control

string srcPath = @"network/...../file.bat";
string scanFile = Uploadfile1.PostedFile.FileName;

It worked correctly when the batch file in my local drive, but it is not working when the batch file and the uploaded file stored in a shared drive.

Gerhard
  • 22,678
  • 7
  • 27
  • 43
Marwa
  • 11
  • 3
  • This seems to be a duplicate of https://stackoverflow.com/questions/14498206/running-batch-file-with-arguments-from-c-sharp but it's a bit difficult to completely understand what you're trying to achieve - have a read of it and see if it helps you. There isn't any restriction on doing it with a batch file on a network drive as far as I know, but remember that UNC paths look more like `\\SERVERNAME\path\to\file.bat` – Caius Jard May 26 '19 at 09:13
  • I just checked it out, it is related to a local drive and I am asking about how to access files stored in shared drive. – Marwa May 26 '19 at 09:34
  • Yes, I followed the UNC standard, sorry for the typo – Marwa May 26 '19 at 09:34
  • The question is, I need to know how to send the path of a file stored in a shared drive as an argument of a batch file – Marwa May 26 '19 at 09:36
  • Same way as you would normally. See the linked question. Remember to quote the path – Caius Jard May 26 '19 at 19:18

0 Answers0