I want to create a bat file that asks the user for a default value. Everything is fine, I found a CScript way.
But I have a problem with special characters like pharanteses ..
Bat file is located
set "mysql_password="
title MyUniqueTitle
CScript //E:JScript //Nologo "%cscripts_path%\sendkeys.js" "MyUniqueTitle" "&GS)u**,o7,r"
set /p "mysql_password=> Enter new MySQL Password: "
and sendkeys.js
try
{
var WshShell = WScript.CreateObject('WScript.Shell');
var Title = WScript.Arguments.Item(0);
var Message = WScript.Arguments.Item(1);
WshShell.AppActivate(Title);
WshShell.SendKeys(Message)
WScript.Quit(0);
}
catch(e)
{
WScript.Echo(e);
WScript.Quit(1);
}
WScript.Quit(2);
The problem is with WshShell.SendKeys (Message), here I have to use the escape function, which puts marriages in special characters.
Does anyone know a way to escape the message code from SendKeys?
Thank!
source
share