'Echo off in bat file isn't working
So I wrote a short bat file which creates user and some more:
@echo off
net user egzamin /add
net user egzaming /expires:17/07/17
net user egzamin /logonpasswordchg:YES
pause
exit
what I get from it is:
C:\Users\Ja\Desktop>´╗┐@echo /off
'´╗┐@echo' is not recognized as an internal or external command,
operable program or batch file.
Rest works just fine
Solution 1:[1]
Your editor saved the file with a BOM
= byte order mark. You can check this viewing the file with a hex viewer.
> hex.exe Test.txt
HEX: +00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 0123456789abcdef
0000000000: EF BB BF 40 45 63 68 6F 20 6F 66 66 ยด??@Echo off
To avoid this take care when saving and select the proper encoding and no BOM.
Solution 2:[2]
Use a proper text editor to edit batch files. Editplus is my preference - others use notepad++ and other utilities.
Note pad is barely adequate, and like word-processors, attempts to format the text to "make sense".
You need to save your file as ASCII - you appear to have some extraneous characters before the @
Solution 3:[3]
Save the .Bat file as:
UTF8 without BOM
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Magoo |
Solution 3 | Roberto Mutti |