Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

PROBLEM DESCRIPTION or QUESTION

...

RESOLUTION

Windows Registry Editor Version 5.00
최근에 윈도우를 업데이트했습니다. 현재 Windows 빌드 버전은 26100.2894(24H2)입니다. xsh.Screen.WaitForStrings()가 JavaScript로 작성된 스크립트에서는 더 이상 작동하지 않습니다. 참고로 Python으로 작성된 스크립트에서는 예상대로 작동합니다. JavaScript에서 이 함수는 예상되는 값 1 대신 -1을 즉시 반환합니다.

Code Block
function Main() {
  xsh.Screen.Synchronous = true;
  xsh.Screen.Send('sleep 2 && hostname\n');
  var arr = ['$'];
  var result = xsh.Screen.WaitForStrings(arr, 5000);
  xsh.Dialog.MsgBox(result);
}


Windows Version: Windows 11


RESOLUTION

...

윈도우 11의 24H2 버전에서 Jcript.DLL에 변경이 있었습니다.

https://learn.microsoft.com/en-sg/answers/questions/2130135/jscript-runtime-error-in-windows-11-24h2

이로 인해 Xshell에서 사용하는 xsh.Screen.WaitForStrings 함수가 제대로 작동하지 않는 문제가 발생합니다.

문제의 근본적인 해결 방법을 찾아 적용하기까지 레지스트리의 다음 정보를 적용하면 이전처럼 Xshell의 JS 스트립트를 사용할 수 있습니다.

Code Block
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Internet Explorer\Main]

...


"JScriptReplacement"=dword:00000000

참고: Internet Explorer, Main 레지스트리 키는 없다면 생성해야 합니다.