title: Why is the wsl command not found by CMD on starting a batch file with a double click in FreeCommander?
body: <p>I want to use a batch script to start Docker in Windows Subsystem for Linux at login. It works when I run the batch file as administrator. So I followed this guide: <a href="https://www.thewindowsclub.com/run-as-administrator-for-batch-files" rel="nofollow noreferrer">Always Run Batch file as Administrator in Windows 10</a></p>
  <p>Then I placed the shortcut into the <code>Startup</code> folder. The script is started, but it exits always at the first line.</p>
  <p>Then I tried to run manually the batch file in <em>FreeCommander</em>. The batch script works when I run the script as administrator via right click context menu item. But there is output an error message when I run the batch script with a double click. The output error message is:</p>
  <blockquote>
  <p>The command &quot;wsl&quot; is either misspelled or could not be found.</p>
  </blockquote>
  <p>This is the batch script:</p>
  <pre><code>FOR /F &quot;tokens=* USEBACKQ&quot; %%g IN (`wsl.exe sh -c &quot;hostname -I&quot;`) do (SET &quot;ip=%%g&quot;)
  netsh interface portproxy add v4tov4 listenport=2375 connectport=2375 connectaddress=%ip%
  wsl sh -c &quot;sudo dockerd -H tcp://%ip%&quot;
  </code></pre>
  <p>I removed also once Windows Subsystem for Linux completely and reinstalled it, but the problem persists.</p>