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

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
MikeS771
Posts: 1
Joined: 12 Aug 2014 09:58

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

#1 Post by MikeS771 » 12 Aug 2014 10:04

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>

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

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

#2 Post by aGerman » 12 Aug 2014 11:48

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 ...

Yury
Posts: 115
Joined: 28 Dec 2013 07:54

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

#3 Post by Yury » 12 Aug 2014 15:38

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

Post Reply