Why my Win 10 is not recognizing jmeter .bat
& .cmd
commands -- jmeterw.cmd
and jmeter.bat
run just fine. But without the extension (jmeterw
and jmeter
) they will fail. I've never seen such problem before:
C:\>set PATH=D:\Programs\apache-jmeter-5.4\bin;%PATH%
C:\>where jmeter
D:\Programs\apache-jmeter-5.4\bin\jmeter.bat
C:\>jmeter
'jmeter' is not recognized as an internal or external command,
operable program or batch file.
C:\>where jmeter-no-no
INFO: Could not find files for the given pattern(s).
C:\>where jmeterw
D:\Programs\apache-jmeter-5.4\bin\jmeterw.cmd
C:\>jmeterw
'jmeterw' is not recognized as an internal or external command,
operable program or batch file.
C:\>D:\Programs\apache-jmeter-5.4\bin\jmeterw.cmd
'jmeter' is not recognized as an internal or external command,
operable program or batch file.
C:\>jmeterw.cmd
'jmeter' is not recognized as an internal or external command,
operable program or batch file.
C:\>jmeter.bat
Picked up _JAVA_OPTIONS: -Xmx512M
...
C:\>set pathext
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
C:\>echo %pathext%
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
C:\>ver
Microsoft Windows [Version 10.0.19041.630]
Everything works just fine in my another old machine, and I can't tell the differences between the two except the Windows version.
UPDATE:
@Compo, my %PATHEXT%
variable is unlike the cause as this is a brand new machine provided by our IT department, neither them nor I would fiddle that. On the same machine other .bat
/.cmd
command works just fine. Only those jmeter ones are problematic.
what it looks like when transferred by you into your question area and formatted, does not prove to me that your semicolons and periods are the correct characters, they just look like them.
They are good. To ensure you, I've verified with my hexdump -C
from my WSL:
00000000 2e 43 4f 4d 3b 2e 45 58 45 3b 2e 42 41 54 3b 2e |.COM;.EXE;.BAT;.|
00000010 43 4d 44 3b 2e 56 42 53 3b 2e 56 42 45 3b 2e 4a |CMD;.VBS;.VBE;.J|
00000020 53 3b 2e 4a 53 45 3b 2e 57 53 46 3b 2e 57 53 48 |S;.JSE;.WSF;.WSH|
00000030 3b 2e 4d 53 43 |;.MSC|
$ echo '.;' | hexdump -C
00000000 2e 3b 0a |.;.|
00000003
Anyway, I've done the registry setting with the command you gave me,
and open a new cmd.exe instance for testing after having done that. But the problem remain exactly the same.
PS
On the same machine other
.bat
/.cmd
command works just fine.
Just to illustrate that:
where kotlin
INFO: Could not find files for the given pattern(s).
set PATH=C:\Program Files\Android\Android Studio\plugins\Kotlin\kotlinc\bin;%PATH%
C:\>where kotlin
C:\Program Files\Android\Android Studio\plugins\Kotlin\kotlinc\bin\kotlin
C:\Program Files\Android\Android Studio\plugins\Kotlin\kotlinc\bin\kotlin.bat
C:\>where kotlinc
C:\Program Files\Android\Android Studio\plugins\Kotlin\kotlinc\bin\kotlinc
C:\Program Files\Android\Android Studio\plugins\Kotlin\kotlinc\bin\kotlinc.bat
C:\>kotlinc
Picked up _JAVA_OPTIONS: -Xms512M -Xmx1g
Apr 09, 2021 9:50:20 AM org.jline.utils.Log logr
. . .
Final UPDATE:
Found where the problem is:
copy D:\Programs\jmeter\bin\jmeter.bat C:\Temp
set PATH=C:\Temp;%PATH%
C:\>where jmeter
C:\Temp\jmeter.bat
D:\Programs\jmeter\bin\jmeter.bat
C:\>jmeter
The JMETER_HOME environment variable is not defined correctly
This environment variable is needed to run this program
C:\>D:\Programs\jmeter\bin\jmeter
'D:\Programs\jmeter\bin\jmeter' is not recognized as an internal or external command,
operable program or batch file.
C:\>C:\Temp\jmeter
The JMETER_HOME environment variable is not defined correctly
This environment variable is needed to run this program
BINGO! It runs from C:
but not from D:
. What's problem running from D:
? The situation is, this is a brand new machine provided by our IT department which has only a single C:
drive. I shrunk it and added D:
drive myself. Never thought that would cause me trouble. How to solve it?
Any help appreciated.
Based upon the information you've provided, I recall seeing a discussion about an issue with %PATHEXT%
related to case sensitivity in directories created using WSL.
Here is a link Issue #3487 to that discussion, which also references Issue #3356.
It appears WSL can create directories with a property which causes those directories to be case-sensitive. Obviously this means that your .bat
and .cmd
extensions, do not then match the .BAT
and .CMD
extensions listed under %PATHEXT%
.
There is some additional official information about this per-directory case sensitivity in a Microsoft blog post, here. It includes suggested fixes using fsutil.exe
, or reg.exe
.
For a quick workaround you could try simply changing the extensions of your two files, from .bat
to .BAT
and .cmd
to .CMD
respectively. Alternatively you could change your %PATHEXT%
value string from .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
to .COM;.com;.EXE;.exe;.BAT;.bat;.CMD;.cmd;.VBS;.vbs;.VBE;.vbe;.JS;.js;.JSE;.jse;.WSF;.wsf;.WSH;.wsh;.MSC;.msc
.
An alternative thought, (untested) may be to rename
your directory, then use robocopy.exe
to copy it to a new directory with the original name.