How i can convert UTF-16 to ANSI in a .cmd file?
Asked
Active
Viewed 907 times
-3
-
2Perhaps you are using the wrong character encoding (ASCII/ANSI or Unicode)? – aschipfl Jun 04 '20 at 17:16
-
You can't encrypt batch scripts (well, you can, but they won't run afterward). `type file.bat` should give you your script in clear text. – Stephan Jun 04 '20 at 17:28
-
1Open in notepad, save it (with another name to not overwrite your original - just in case) and be sure, "Encoding" is set to "ANSI" – Stephan Jun 04 '20 at 17:44
-
The terminology here is confused. "ANSI" in this context just means whatever your system was configured to use (and it basically never had anything to do with the American National Standards Institute; rumor has it that Microsoft is finally getting rid of this misnomer, but by the looks of it, this is not a priority). Name the actual encoding you want. – tripleee Nov 05 '22 at 07:47
1 Answers
1
Your code has a UTF-16 LE byte-order-marker at the beginning of it, which an obfuscation technique developed on DosTips. Either remove it via a hex editor, or save this code as deobfuscate.bat and drag your script onto it:
@echo on &setlocal
if "%~1"=="" exit /b
if /i "%~x1" neq ".bat" if /i "%~x1" neq ".cmd" exit /b
<"%~1" ((for /l %%N in (1 1 8) do pause)>nul&findstr "^">"%~n1___%~x1")

SomethingDark
- 13,229
- 5
- 50
- 55
-
-
no, i ve been accepted but when i go here again is "unaccept", and the button doenst works – DeathZ Jul 24 '20 at 19:59