Page 1 of 1

Please Help! - Html In batch file messes up special chars

Posted: 12 Aug 2014 10:04
by MikeS771
Why does my batch file code keep going all weird after running internal html? How do I fix this?

f you take the html code and the call for the html code out of the provided code below, the special characters make a bar on the command line window, but for some reason with the html, it wont, why?? Please help! :?: :( :?:

Code: Select all

<!-- : 
 @echo off
 cls
 for /f "tokens=* delims=" %%p in ('mshta.exe "%~f0"') do (
 set "pass=%%p"
 )
 REM The Next Line normally makes a bar, but with html in the code, it just shows characters

 echo ษอออออออออออออออออออออออออออออป

-->

 <html>
 <head><title>Password Login</title></head>
 <body>

 <script language='javascript' >
 function pipePass() {
 var pass=document.getElementById('pass').value;
 var fso= new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1);
 close(fso.Write(pass));

 }
 </script>

 <input type='password' name='pass' size='15'></input>
 <hr>
 <button onclick='pipePass()'>Submit</button>

 </body>
 </html>

Re: Please Help! - Html In batch file messes up special char

Posted: 12 Aug 2014 11:48
by aGerman
I'm neither able to paste these characters into a cmd window nor am I able to save them into a batch file. It always shows question marks because the code page for my editor is 1252 and for the console window is 852.
Where are you from and what are the code points (character encodings) you are working with in your country?

Regards
aGerman

EDIT
by the way have a look at Hidden_Input.bat in case you are interested in a pure batch solution ...

Re: Please Help! - Html In batch file messes up special char

Posted: 12 Aug 2014 15:38
by Yury

Code: Select all

@for /f "delims=" %%p in ('mshta "about: <html><head><title>Password Login</title></head><body><script language='javascript'>function pipePass() {close(new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).Write(document.getElementById('pass').value));}</script><input type='password' name='pass' size='15'></input><hr><button onclick='pipePass()'>Submit</button></body></html>"') do @(for /l %%i in (1 1 30) do @set /p"=#"<nul& for /l %%j in (1 1 100) do @pause<nul>nul)& echo. & set pass=%%p& cmd /v:on /c echo !pass!& pause>nul& exit /b