title: Running Python batch files from windows search window - why I can`t start a program that uses selenium and Firefox this way?
body: <p>I wrote a bunch of bat files to start my Python scripts from command line (that is using cmd). But it turnes out that I don`t even have to move into command line because if I type the name of the batch file in windows 10 search window the code start running. With one exception, though.</p>
  
  <p>I have got a script that uses selenium and Firefox. When I start it with batch file from windows 10 search window it quits when it gets to the code line with Firefox. If I start it from command line it works, as it should.</p>
  
  <p>Here is a simple example of the type of code I am writing about:</p>
  
  <pre><code>#! python3
  
  from selenium import webdriver
  
  browser = webdriver.Firefox()
  browser.get("https://www.google.com")
  </code></pre>
  
  <p>And here is the code from the batch file:</p>
  
  <pre><code>@py.exe C:\Users\PC\Desktop\python_work\name_of_the_file.py %*
  </code></pre>
  
  <p>Intrestingly, when I exchange in the Python script Firefox for Chrome the problem dissappears. Here is the version of code that starts and keeps running if I start it with the same batch file from the windows 10 search window:</p>
  
  <pre><code>#! python3
  
  from selenium import webdriver
  
  browser = webdriver.Chrome()
  browser.get("https://www.google.com")
  </code></pre>
  
  <p>I`d appreciate any help with the following questions:</p>
  
  <p>What is the difference between starting a batchfile from windows 10 search window and from command line?</p>
  
  <p>Why can`t I start a program that uses selenium and Firefox this way? Is there a way to fix it?</p>