title: when i running the below code iam getting handle is invalid it takes a string and pass it to remote batch file
body: <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Windows.Forms;
  using System.Diagnostics;
  using System.Security;
  namespace SampleProject
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          private void button1_Click(object sender, EventArgs e)
          {
  
  
              String input = textBox1.Text;
  
              try
              {
  
                  Process ps = new Process();
  
                  ps.StartInfo.FileName = @"\\199.63.55.163\d$\hello.bat";
  
                  ps.StartInfo.Arguments = input;
  
                  ps.StartInfo.CreateNoWindow = false;
  
                  String domain = ps.StartInfo.Domain;
  
                  ps.StartInfo.RedirectStandardOutput = true;
  
                  ps.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
  
                  ps.StartInfo.WorkingDirectory = @"d:\praveen";
  
                  ps.StartInfo.UserName = "Raj";
  
                  ps.StartInfo.Domain = "domain";
  
                  ps.StartInfo.Password = Encrypt("Hello123");
  
  
                  ps.StartInfo.UseShellExecute = false;
  
                  ps.Start();
  
                  ps.WaitForExit();
  
                  MessageBox.Show(ps.StandardOutput.ReadToEnd());
              }
              catch (Exception ex)
              {
                  MessageBox.Show(ex.Message);
              }
          }
  
          private void label1_Click(object sender, EventArgs e)
          {
  
          }
  
          public static SecureString Encrypt(String pwd)
          {
              SecureString ss = new SecureString();
  
              for (int i = 0; i &lt; pwd.Length; i++)
              {
                  ss.AppendChar(pwd[i]);
  
  
              }
  
              return ss;
          }
      }
  }
  </code></pre>