Log file not generating.
c:\WinSCP\WinSCP3.exe /console /script="c:\EMT\AutoFTP.txt" /log="C:\EMT\winscp.log"
No log file ever gets generated. Thanks.
Advertisement
Advertisement
Can you try it with the latest version?
Can you try it with the latest version?
Advertisement
I have the same problem...
Have you got a solution
const string logname = "log.xml"; Process winscp = new Process(); winscp.StartInfo.FileName = "C:\\Program Files\\WinSCP\\winscp.com"; winscp.StartInfo.Arguments = "/log=C:\\"" + logname + "\""; winscp.StartInfo.UseShellExecute = false; winscp.StartInfo.CreateNoWindow = true; winscp.Start(); winscp.StandardInput.WriteLine("option batch abort"); winscp.StandardInput.WriteLine("option confirm off"); winscp.StandardInput.WriteLine("open mysession"); winscp.StandardInput.WriteLine("ls"); winscp.StandardInput.Close(); string output = winscp.StandardOutput.ReadToEnd(); winscp.WaitForExit(); XPathDocument log = new XPathDocument(logname); XmlNamespaceManager ns = new XmlNamespaceManager(new NameTable()); ns.AddNamespace("w", "http://winscp.net/schema/session/1.0"); XPathNavigator nav = log.CreateNavigator(); XPathNodeIterator files = nav.Select("//w:file", ns); Console.WriteLine(string.Format("There are {0} files and subdirectories:", files.Count)); foreach (XPathNavigator file in files) { Console.WriteLine(file.SelectSingleNode("w:filename/@value", ns).Value); }
I have a function with creating log xml file like below. It run well on local machine, but when I publish it to be used as client-server, it can not create a log file. Please help me to check it.
const string logname = "log.xml"; Process winscp = new Process(); winscp.StartInfo.FileName = "C:\\Program Files\\WinSCP\\winscp.com"; winscp.StartInfo.Arguments = "/log=C:\\"" + logname + "\""; winscp.StartInfo.UseShellExecute = false; winscp.StartInfo.CreateNoWindow = true; winscp.Start(); winscp.StandardInput.WriteLine("option batch abort"); winscp.StandardInput.WriteLine("option confirm off"); winscp.StandardInput.WriteLine("open mysession"); winscp.StandardInput.WriteLine("ls"); winscp.StandardInput.Close(); string output = winscp.StandardOutput.ReadToEnd(); winscp.WaitForExit(); XPathDocument log = new XPathDocument(logname); XmlNamespaceManager ns = new XmlNamespaceManager(new NameTable()); ns.AddNamespace("w", "http://winscp.net/schema/session/1.0"); XPathNavigator nav = log.CreateNavigator(); XPathNodeIterator files = nav.Select("//w:file", ns); Console.WriteLine(string.Format("There are {0} files and subdirectories:", files.Count)); foreach (XPathNavigator file in files) { Console.WriteLine(file.SelectSingleNode("w:filename/@value", ns).Value); }
Advertisement
Make sure the account that runs the script has write access to C:\I have a function with creating log xml file like below. It run well on local machine, but when I publish it to be used as client-server, it can not create a log file. Please help me to check it.
First of all, please upgrade to the latest version of WinSCP.I cannot generate the log file with 5.1.2 suddenly. Can anyone help?
Thanks,
Advertisement
You can post new topics in this forum