title: How to disable Open file – Security warning
body: <p>I have a weird question.
  I have written a winform server application and a winform client application.
  The role of the client is to send commands for running a certain script to the server.
  The server receives those commands, parses them, and runs them.</p>
  
  <p>These two work great.</p>
  
  <p>I have written a cmd application which uses some of the functions from my client. This application is supposed to function as a cmd client.</p>
  
  <p>The question is this: When I run the winform client, the server runs the commands with no problems at all.
  When I run the cmd client, when the server attempts to execute the received command, Windows on the server side pops up the security question of whether the script can be run or not (see attached image).</p>
  
  <p>Why does it happen on the cmd and not on the winforms.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using Microsoft.Win32;
  using System.Net.Sockets;
  using System.ComponentModel;
  using System.IO;
  using System.Management;
  
  namespace RemoteBatcher
  {
      class ClientCmdProgram
      {
          private static RegistryKey registryKey;
          private static Socket clientSock;
          private static string remoteIpAddress = "192.168.0.1";
          private static int remotePort = 8;
          private static string userName = "";
          private static string targetPath = "Z:\\nBatcher\\";
          private static List&lt;string&gt; listOfCommands = new List&lt;string&gt;();
  
          static void Main(string[] args)
          {
              var backgroundWorker = new BackgroundWorker();
              userName = RemoteUtils.getConnectedUser();            
              registryKey = Registry.CurrentUser.OpenSubKey("Key");
  
              if (registryKey == null)
              {
                  Console.WriteLine("Error! No Saved Data Was Found In The Registry. Please Run The RemoteBatcherClient App First.");
                  Environment.Exit(1);
              }
  
              if (!connectToServer(backgroundWorker))
                  Environment.Exit(1);
  
              getCommandsList();
              sendCommands(backgroundWorker);
          }
          private static bool connectToServer(BackgroundWorker backgroundWorker)
          {
              try
              {
                  clientSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                  clientSock.Connect(remoteIpAddress, remotePort);
                  backgroundWorker.DoWork += (sender1, e1) =&gt; RemoteUtils.copyDllsToServer(targetPath += userName);
                  backgroundWorker.RunWorkerAsync();
              }
              catch (Exception ex)
              {
                  Console.Write(ex.Message);
                  return false;
              }
  
              return true;
          }
          private static void getCommandsList()
          {
              string[] commandsInRegistry = registryKey.GetValueNames();
  
              for (int i = 0; i &lt; commandsInRegistry.Length; i++)
              {
                  listOfCommands.Add(registryKey.GetValue(commandsInRegistry[i]).ToString());
              }
          }
          private static void sendCommands(BackgroundWorker backgroundWorker)
          {
              int flicker = 100;
              int counter = 100;
              try
              {
  
                  while (backgroundWorker.IsBusy) 
                  {
                      if (counter == flicker)
                      {
                          counter = 1;
                          Console.WriteLine("Copying Executable Files, Please Wait..");
                      }
                      else if (counter == 50)
                      {
                          Console.Clear();
                      }
                      else
                          counter++;
                  }
  
                  for (int i = 0; i &lt; listOfCommands.Count; i++)
                  {
                      clientSock.Send(Encoding.Default.GetBytes(listOfCommands[i] + " &lt;eom&gt; "));
                  }
                  clientSock.Close();
                  clientSock.Dispose();
              }
              catch (Exception ex)
              {
                  Console.Write(ex.Message);
                  Environment.Exit(1);
              }
  
          }
      }
  }
  </code></pre>
  
  <p>Any ideas?</p>