3

This code used to work below on the C Drive where it was installed. We moved it to a UNC path \share and now it doesnt seem to reload the config file. There are no errors, and Filezilla works fine as I can connect and transfer files over on this UNC Share, but from code I cant get this to actually do what it's suppose to anymore. Do I need to do anything special credential wise? My user account for the app pool of the site is the same as the share.

Process.Start("CMD.exe", "/C \"\\filezilla\\FileZilla Server.exe\" /reload-config");

Update

I ran this line from the command prompt on the actual computer and it does what it's suppose to.

Another Update

var path = string.Format("/C \"{0}FileZilla Server.exe\" /reload-config", Config.Paths.FileZillaPath); // \\filezilla\
Process.Start("CMD.exe", path);
Logger.Debug("Path: " + path); // Path: /C "\\filezilla\FileZilla Server.exe" /reload-config
Mike Flynn
  • 22,342
  • 54
  • 182
  • 341

2 Answers2

10

Your first pair of backslashes in the UNC path aren't escaped properly and will result in a single backslash. Try

Process.Start("CMD.exe", "/C \"\\\\filezilla\\FileZilla Server.exe\" /reload-config");

You can see an example at MSDN

string g = "\\\\server\\share\\file.txt"; // \\server\share\file.txt

string h = @"\\server\share\file.txt"; // \\server\share\file.txt

Community
  • 1
  • 1
Tone
  • 1,701
  • 1
  • 17
  • 18
  • Is the new update right above? The path spits out `/C "\\filezilla\FileZilla Server.exe" /reload-config` – Mike Flynn Apr 19 '16 at 01:44
  • Yes that looks to be correct. Is it still not running? If not, open a command window and run `CMD.exe /C "\\filezilla\FileZilla Server.exe" /reload-config` to see if you get any errors. (I believe you've done this already but just check the syntax matches that). – Tone Apr 19 '16 at 11:56
3

I've done something similar but like this...

 Process reloadConfig = new Process();
 reloadConfig.StartInfo.FileName = @"\\MachineName\FileZilla Server\FileZilla Server.exe\";
 reloadConfig.StartInfo.Arguments = @"/reload-config";
 reloadConfig.Start();

and that works for me.

JimDel
  • 4,309
  • 11
  • 54
  • 99