Need to run a script in unix from windows c# application

Advertisement

Sam_9417
Guest

Need to run a script in unix from windows c# application

Hi,

I need to run my script file example.sh in the unix server so i use to run in unix like sh example.sh in the black window and that how it worked but i wanted to run it from the windows application. so i wrote the following code but it's not working. Any help will be great.

Process winscp = new Process();
winscp.StartInfo.FileName = "winscp.com";
winscp.StartInfo.Arguments ="/xmllog=xml.log";
winscp.StartInfo.UseShellExecute = false;
winscp.StartInfo.RedirectStandardInput = true;
winscp.StartInfo.RedirectStandardOutput = true;
winscp.StartInfo.CreateNoWindow = true;
winscp.Start();

winscp.StandardInput.WriteLine("option batch abort");
winscp.StandardInput.WriteLine("option confirm off");
winscp.StandardInput.WriteLine("Open new_user:new_user@123user");
winscp.StandardInput.WriteLine("sh home/user/new_directory/example.sh")
winscp.StandardInput.WriteLine("close");
winscp.StandardInput.Close()
string output= winscp.StandardOutput.ReadToEnd();

but it's not working. please any help me.

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum