Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

Sam_9417

Sorry i wrongly mentioned "sh example.sh" i am using call example.sh
Sam_9417

Sorry i wrongly mentioned "sh example.sh" i am using call example.sh
Sam_9417

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.