addAHostMap

语法

System.addAHostMap( , , [isReplace] )

类别

System

描述

往host文件添加一条主机名到IP地址的映射关系

参数

参数名参数类型默认值描述是否必填
hostnamestring—-主机名
ipstring—-IP地址
isReplacebooleantrue是否替换目标映射关系

返回值

无返回值。

错误

如果出错则抛异常,并输出错误信息,可以通过getLastErrMsg()获取错误信息或通过getLastError()获取错误码。 关于错误处理可以参考常见错误处理指南

常见错误可参考错误码

示例

  • 往host文件添加一条主机名到IP地址的映射关系

    1. > System.addAHostMap( "hostname", "1.1.1.1" )