2012-12-17 2 views
1

A.vbS, B.VBS, C.VBS, D.VBS 등 4 개의 .vbs 파일이 있습니다. 다음과 같은 순서로 호출하고 싶습니다..VBS 파일을 자동으로 호출합니다.

 (1)A.VBS 
     (2)B.VBS 
     (3)C.VBS 
     (4)D.VBS 

첫 번째 작업이 완료되면 두 번째 작업이 자동으로 시작되어야합니다.

그런 작업을 도와 줄 수 있습니까?

편집 :

Option Explicit 

    Dim oShell : Set oShell = WScript.CreateObject ("WScript.Shell") 
    Dim FSO : set FSO = CreateObject("Scripting.FileSystemObject") 
    Dim Path 

    REM oShell.run "ParentChildLinkFinal.vbs", 1, True 
    REM oShell.run "Parent_Child_Merge_final.vbs", 1, True 
    REM oShell.run "Baddata.vbs", 1, True 
    REM oShell.run "CycleTime.vbs", 1, True 
    msgBox(oShell.CurrentDirectory) 
    MsgBox(FSO.GetFile(Wscript.ScriptFullName).ParentFolder) 
    Path=FSO.GetFile(Wscript.ScriptFullName).ParentFolder 

    oShell.run Path\ParentChildLinkFinal.vbs, 1, True 
    oShell.run Path\Parent_Child_Merge_final.vbs, 1, True 
    oShell.run Path\Baddata.vbs, 1, True 
    oShell.run Path\CycleTime.vbs, 1, True 

나는 다음과 같은 오류 얻을 :

Variable is undefined : "arentChildLinkFinal.vbs"

이에 대한 수정은 무엇입니까?

Dim oShell : Set oShell = WScript.CreateObject ("WScript.Shell") 
oShell.run "A.VBS", 1, True 
oShell.run "B.VBS", 1, True 
oShell.run "C.VBS", 1, True 
oShell.run "D.VBS", 1, True 

당신은 또한 할 수있는 대안으로 : 다른 VBS에서 실행하려면 가정

+1

편집 된 파트의 경우 "Path \ ParentChildLinkFinal.vbs"와 같이 이름을 따옴표로 묶어야합니다. 죄송합니다. 경로가 변수라는 것을 알았습니다. 두 번째 예제를 사용하여 업데이트 된 답변을 확인하면 경로를 포함 할 필요가 없으며 단지 "ParentChildLinkFinal.vbs"일 수 있습니다. – PeterJ

+0

@ PeterJ 당신이 나에게 오늘 제공 한 탁월한 컨셉! 방금 당신에게'+ 1'을주었습니다. 그리고 내 글은'StackOverflow'에서 그런 연구를하기 위해'+ 1'을 좀 더 얻을 것으로 생각합니다. –

답변

2

는 작업 디렉토리가 다른 스크립트와 같은 경우 다음을 사용하거나 그렇지 않으면 전체 경로를 포함 할 수있는 파일

,536,913을 다음 매개 변수의 의미와 기타 정보를 여기에 참조하십시오

Dim oShell : Set oShell = WScript.CreateObject ("WScript.Shell") 
Dim FSO : Set FSO = CreateObject("Scripting.FileSystemObject") 
oShell.CurrentDirectory = FSO.GetFile(Wscript.ScriptFullName).ParentFolder 
oShell.run "A.VBS", 1, True 
oShell.run "B.VBS", 1, True 
oShell.run "C.VBS", 1, True 
oShell.run "D.VBS", 1, True 

: 스크립트가 포함 된 폴더로 현재 디렉토리를 설정하는 코드를 확장

http://technet.microsoft.com/en-us/library/ee156605.aspx

+0

감사합니다 피터, 도와주세요! :-) –

+0

게시물에 대한 도움이 필요합니까? http://stackoverflow.com/questions/13895587/sorting-order-check-using-vbscript#comment19153813_13895587 –

+0

예, 맞습니다. 기본 시작 경로가 Windows 버전 또는 시작 방법에 따라 조금씩 다를 수 있지만, 따라서 문제가없는 파일을 실행하면 전체 경로를 사용해보십시오. 필자는 종종 Windows 작업 이벤트에서 비슷한 생각을하고 스크립트의 위치에 대한 기본 경로를 설정할 수 있도록합니다. – PeterJ

관련 문제