다음을 통해 공유


.scriptrun(스크립트 실행)

.scriptrun 명령은 JavaScript를 로드하고 실행합니다.

.scriptrun ScriptFile  

매개 변수

ScriptFile
로드하고 실행할 스크립트 파일의 이름을 지정합니다. ScriptFile 에는 .js 파일 이름 확장명을 포함해야 합니다. 절대 또는 상대 경로를 사용할 수 있습니다. 상대 경로는 디버거를 시작한 디렉터리를 기준으로 합니다. 공백을 포함하는 파일 경로는 지원되지 않습니다.

환경

항목 설명
모드 사용자 모드, 커널 모드
대상 라이브, 크래시 덤프
플랫폼 모두

추가 정보

.scriptrun 명령은 스크립트를 로드하고 다음 코드를 실행합니다.

  • root
  • intializeScript
  • invokeScript

코드가 로드되고 실행될 때 확인 메시지가 표시됩니다.

0:000> .scriptrun C:\WinDbg\Scripts\helloWorld.js
JavaScript script successfully loaded from 'C:\WinDbg\Scripts\helloWorld.js'
Hello World!  We are in JavaScript!

스크립트에서 수행한 개체 모델 조작은 이후에 스크립트가 언로드되거나 다른 콘텐츠로 다시 실행될 때까지 그대로 유지됩니다.

이 표에는 .scriptload 및 .scriptrun에서 실행되는 함수가 요약되어 있습니다.

.scriptload .scriptrun
root
initializeScript
invokeScript
uninitializeScript

이 코드를 사용하여 .script run 명령을 사용하여 호출되는 함수를 확인할 수 있습니다.

// Root of Script
host.diagnostics.debugLog("***>; Code at the very top (root) of the script is always run \n");


function initializeScript()
{
    // Add code here that you want to run every time the script is loaded. 
    // We will just send a message to indicate that function was called.
    host.diagnostics.debugLog("***>; initializeScript was called \n");
}

function invokeScript()
{
    // Add code here that you want to run every time the script is executed. 
    // We will just send a message to indicate that function was called.
    host.diagnostics.debugLog("***>; invokeScript was called \n");
}

JavaScript 작업에 대한 자세한 내용은 JavaScript 디버거 스크립팅을 참조 하세요. 디버거 개체에 대한 자세한 내용은 JavaScript 확장의 네이티브 개체를 참조 하세요.

요구 사항

.script 명령을 사용하기 전에 스크립팅 공급자를 로드해야 합니다. .load(Load Extension DLL) 명령을 사용하여 JavaScript 공급자 dll을 로드합니다.

0:000> .load C:\ScriptProviders\jsprovider.dll

참고 항목

.scriptload(스크립트 로드)

JavaScript 디버거 스크립팅