2013-04-05 23 views
0

我使用WShell.Run從VB腳本調用Java代碼。它返回一個代碼143.這是什麼意思?我在哪裏可以得到運行方法可以返回的錯誤代碼列表?WShell.Run返回143

回答

0

此代碼由您的Java應用程序返回。從MSDN

下面的VBScript代碼做同樣的事情,除了它指定的窗口類型,等待用戶關閉記事本,並保存記事本關閉時返回的錯誤代碼。

Set WshShell = WScript.CreateObject("WScript.Shell") 
Return = WshShell.Run("notepad " & WScript.ScriptFullName, 1, true) 

2

這裏是參照System Error Codes

ERROR_SAME_DRIVE 143(值爲0x8F)系統不能加入或替代爲 驅動器或對於相同的驅動器上的目錄。

P.S.我認爲未來筆記是出了問題,但以防萬一...

只是要注意的是Err對象爲大多數代碼「虛擬」 Description未知的運行錯誤)。如果您想了解過濾列表所有明智的描述,你可以這樣做:

With CreateObject("InternetExplorer.Application") 
    Const DUMMY = "Unknown runtime error" 
    ReDim aryLines(15999) 
    Dim cnt, i, w, h 
    cnt = -1 

    .Navigate "about:blank" 
    .Document.Title = "Error Codes " & String(100, Chr(1)) 
    .ToolBar  = False 
    .Resizable  = True 
    .StatusBar  = False 
    .Width   = 420 
    .Height   = 380 

    With .Document.ParentWindow.Screen 
     w = .AvailWidth 
     h = .AvailHeight 
    End With 
    .Left = (w - .Width) \ 2 
    .Top = (h - .Height) \ 2 

    Do While .Busy : WScript.Sleep 200 : Loop 

    On Error Resume Next 
    With Err 
     For i = 1 To 15999 
      .Raise i 
      If .Description <> DUMMY Then 
       cnt = cnt + 1 
       aryLines(cnt) = AddZero(i) & .Description 
      End If 
      .Clear 
     Next 
    End With 
    On Error GoTo 0 

    ReDim Preserve aryLines(cnt) 
    .Document.Body.InnerHTML = "<pre id=x>" & Join(aryLines, vbNewLine) 
    .Document.Body.Style.overflow = "auto" 
    .Document.All.X.Style.fontFamily = "Verdana, sans-serif" 
    .Visible = True 
End With 

Function AddZero(nVar) 
    AddZero = "<b>" & Right("00000" & nVar, 5) & "</b> " 
End Function 

screen capture result