F
F
Fairlancer2016-08-23 04:33:38
cmd/bat
Fairlancer, 2016-08-23 04:33:38

Strange SendKeys bug on VBS, 3 hours can't find an answer?

According to the logic of things, the script should create a console, change the encoding to Windows-1251, send the English text "KPACUBO" and emulate pressing Enter. But the encoding does not change "The line swears that the file is not found, if I write cmd \ C in front of it, then a completely different console opens and everything changes there, but I need this one." BUT the most important thing is that the Russian text is displayed normally and the Latin is not clear how (some letters are transliterated into Russian, some are displayed as symbols), I thought that the matter was in the encoding, but I can’t even change it.

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd"
WScript.Sleep 1000
WshShell.Exec("chcp 1251")
rem Назначаем кодировку 1251 (не работает)
WScript.Sleep 1000
WshShell.SendKeys "KPACUBO" & chr(13)
rem Отправляем текст в консоль и эмулируем нажатие Enter

The output in the console of the word KPACUBO (displayed as lzfsgisch):
6c4fc1225afb35de7790cb65bfbfaa94.png
Comrades, do not kick much, I am writing the question because I lost hope of understanding how it should be right.
UPD 1
WshShell.Run "cmd /K chcp 1251"
It was possible to set the encoding in this console, but the problem is not solved.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ananiev, 2016-08-23
@SaNNy32

WshShell.Run "cmd /K chcp 1251"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question