NetBox 2.7 使用手册

Command 方法

执行 NetBox 内置的命令行解释器

语法

Shell.Command
 

注释

Shell.Commane 将执行 NetBox 内置的命令行解释器。在 NetBox 执行时,如果没有发现 main.box 和 main.nbl,则将自动进入 Shell.Command 执行命令行解释器。

NetBox 内置的命令行解释器的执行流程与下面的代码相同:

Set Console = Shell.Console
Set SubArgs = CreateObject("NetBox.Arguments")

Do While True
    Console.Write "#"
    strCommand = Console.ReadLine
    If LCase(strCommand) = "exit" Then Exit Do
    SubArgs.CommandLine = strCommand

    If SubArgs.Count > 0 Then
        strExecFile = SubArgs(0)
        If LCase(Right(strExecFile, 4)) <> ".box" Then
            strExecFile = strExecFile + ".box"
        End If

        Set Script = CreateObject("NetBox.Script")

        e = Script.Load(strExecFile)
        If e = 0 Then
            Script.SetGlobalObjects
            Script.AddNameItem "Arguments", SubArgs

            e = Script.Run
        End If

        If e = 404 Then
            Console.WriteLine "Bad Command"
        ElseIf e <> 0 Then
            Set error = Script.GetLastError
            Console.WriteLine error.Category
            Console.WriteLine "Error Number: " & Hex(error.Number)
            Console.WriteLine "File: " & error.File
            Console.WriteLine "Line: " & error.Line
            Console.WriteLine error.Description & vbCRLF
            Set error = Nothing
        End If

        Set Script = Nothing
    End If
Loop

应用于

Shell 对象
版权所有: 2003- 网络盒子