0

我正在使用 WShell.Run 从 VB 脚本调用 java 代码。它返回一个代码 143。这是什么意思?我在哪里可以获得运行方法可以返回的错误代码列表?

4

2 回答 2

2

这是对系统错误代码的参考。

ERROR_SAME_DRIVE 143 (0x8F) 系统无法将驱动器加入或替代同一驱动器上的目录。

PS我认为下一个笔记是不可能的,但以防万一......

请注意,对于大多数代码,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

截屏结果

于 2013-04-05T20:15:49.130 回答
0

this code returned by your java application. From MSDN

The following VBScript code does the same thing, except it specifies the window type, waits for Notepad to be shut down by the user, and saves the error code returned from Notepad when it is shut down.

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

于 2013-04-05T16:23:37.930 回答