易语言 修改一个文件

想修改 C:\WINDOWS\system32\drivers\etc目录下的 hosts

想在文本最后一条加上127.0.0.1 www.baidu.com 如果有这条不加上没有就加上应该什么写 给下源码
原来文本是这样的
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
想加成这样的
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

127.0.0.1 www.baidu.com

.版本 2

.局部变量 文件号, 整数型

文件号 = 打开文件 (“C:\WINDOWS\system32\drivers\etc\hosts.txt”, , ) ' 不知是不是TXT文件,不是就改。
移到文件尾 (文件号)
写出文本 (文件号, #换行符 + “127.0.0.1 www.baidu.com”)
关闭文件 (文件号)
温馨提示:答案为网友推荐,仅供参考
相似回答