Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't execute exe in for-loop in clause
    primarykey
    data
    text
    <p>I have this in a batch file called find_java.bat:</p> <pre><code>@echo off for /f "delims=" %%a in ('C:\Programming\Android\android-sdk\tools\lib\find_java.exe') do (set java_exe=%%a) </code></pre> <p>The problem is that when I run this batch file I get:</p> <pre><code>'C:\Programming\Android\android-sdk\tools\lib\find_java.exe' is not recognized as an internal or external command, operable program or batch file. </code></pre> <p>However when the batch file contains just:</p> <pre><code>@echo off C:\Programming\Android\android-sdk\tools\lib\find_java.exe </code></pre> <p>it executes the command just fine.</p> <p>I'm new to writing batch files, but looking at online examples this should work...</p> <p><strong>Edit: Sorry for revisiting this so late.</strong></p> <p>I found the solution. It had something to do with ComSpec for reasons I still don't quite understand. My ComSpec was</p> <pre><code>%SystemRoot%\system32\cmd.exe; </code></pre> <p>I went into the registry and changed </p> <pre><code>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\ComSpec </code></pre> <p>from</p> <pre><code>%SystemRoot%\system32\cmd.exe; </code></pre> <p>to</p> <pre><code>C:\Windows\system32\cmd.exe </code></pre> <p>then logged out and back in and magically it worked. %SystemRoot% was C:\Windows, all the other system variables use it, and </p> <pre><code>@echo off for /f "delims=" %%a in ('"C:\Programming\Android\android-sdk\tools\lib\find_java.exe"') do (set java_exe=%%a) </code></pre> <p>worked perfectly, so I honestly don't understand but see <a href="https://stackoverflow.com/questions/9668011/command-line-for-f-fails">Command Line FOR /F Fails</a> to possibly make more sense of it than I did.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload