When I logon to this Windows 2008 R2 Server and launch a CMD window, the default directory is:
C:\Users\SVC_asl2trim>
So I added this to the PATH and then I issued:
C:\Users\SVC_asl2trim>set path
Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32
\WindowsPowerShell\v1.0\;D:\Program Files\Hewlett-Packard\HP TRIM\;C:\Users\SVC_
asl2trim\
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
C:\Users\SVC_asl2trim>
I have a small .bat file in that directory above but I keep getting:
my.bat not recognized as an internal or external command, operable program or batch file
This is maddening. I do this so infrequently .... I know there is some trick I am forgetting.
My stupid mistake...
Credit should go to Dennis for verifying that my.bat should work but as he surmised, it was not named that. I thought I had renamed it correctly from my.txt to my.bat but the problem was that it was actually named my.bat.txt ! Fixing that was key to this problem.
I was getting this error because my batch file was not ascii encoded; it was utf-8.
Since UTF and UCS often contain a BOM at the start of the file, make sure to save it as ASCII or UTF-8 without the BOM.
If you really need an alternate encoding, making the first line blank can sometimes work (for me the UTF-8 BOM doesn't stop execution, but the USC-2 one does). Both will print an error message from the first line, so it's not an ideal solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With