1
我想製作一個提示用戶使用默認值的bat文件。沒關係,我找到了一種CScript方式。WScript SendKeys轉義特殊字符
但是我有特殊字符,如pharanteses一個問題..
bat文件是
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: "
和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);
問題是與WshShell.SendKeys(消息) ,在這裏我應該使用一個逃生功能,把鐲子放入特殊字符中。
有誰知道從SendKeys轉義郵件代碼的方法?
謝謝!
批轉義字符是'^'(除非你轉義'%',那麼你使用第二個轉義它)。 – SomethingDark
您的意思是?如果我添加)像WshShell.SendKeys(&GS {)} u **,o7,r)這樣的大括號將會像它應該那樣工作。因此需要一種使用SendKey方法的方法來使用轉義規則。 – oriceon
以下是特殊字符的有效代碼:http://orporate.technet.microsoft.com/wiki/contents/articles/5169.vbscript-sendkeys-method.aspx –