![]() |
中国DOS联盟-- 联合DOS 推动DOS 发展DOS --联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum |
| 游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟 |
|
中国DOS联盟论坛 现在时间是 2026-08-12 23:23 |
共 47,811 主题排行 / 349,897 发帖 / 今日 0 篇 / 48,256 会员排行 |
| DOS批处理 & 脚本技术(批处理室) » vbs代码运行出错,提示缺少“)”,如何解决? |
| 可打印版本 724 / 1 |
| 第1楼 pzf2008 | 发表于 2009-12-21 17:22 |
| 新手上路 发帖 13 积分 16 | |
|
vbs代码运行出错,提示缺少“)”,如何解决? Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("D:\Download\temp\11.txt") Const ForAppending = 8 Set objTextFile1 = objFSO.OpenTextFile ("D:\Download\temp\11.txt", ForAppending, True) Public Function FormatIP(ByVal sIP As String) As String Dim arr() As String Dim i As Integer arr = Split(sIP, ".") For i = 0 To ubound(arr) arr(i) = Format(arr(i), "000") Next FormatIP = Join(arr, ".") End Function Const ForReading = 1 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objTextFile2 = objFSO.OpenTextFile ("D:\Download\temp\temp.txt", ForReading) Do Until objTextFile2.AtEndOfStream strComputer = objTextFile2.ReadLine objTextFile1.WriteLine(FormatIP(strComputer)) Loop objTextFile2.Close objTextFile1.Close 以上vbs代码运行红色代码行出错,提示缺少“)”,如何解决? |
|
| 第2楼 qinchun36 | 发表于 2009-12-21 18:16 |
| 高级用户 发帖 400 积分 609 | |
|
兄弟,vbs 不是 vb ,请你搞清楚了,vbs 里面没有数据类型也没有函数类型,也没有Format这种偷奸躲懒的函数,把你的函数改成
下面是VBS官方参考中的一小段话: Visual Basic Scripting Edition 未包含在 VBScript 中的 Visual Basic for Applications 特性 下表列出未包含在 VBScript 中的 Visual Basic for Applications 特性。 类别 特性/关键字 数组处理 Option Base 声明数组下界 <> 0 集合 Add, Count, Item, Remove 使用 ! 字符访问集合 条件编译 #Const #If...Then...#Else 控制流程 DoEvents GoSub...Return, GoTo On Error GoTo On...GoSub, On...GoTo Line numbers, Line labels 转换 CVar, CVDate Str, Val 数据类型 除 Variant 外的所有固有数据类型 Type...End Type 日期/时间 Date 语句、Time 语句 DDE LinkExecute, LinkPoke, LinkRequest, LinkSend 调试 Debug.Print End, Stop 声明 Declare (声明 DLL ) Optional ParamArray Static 错误处理 Erl Error ... ... ... |
|
|
[ 联系联盟系统管理团队 -
中国DOS联盟 -
标准版 ] Sponsored by ifanr Inc | © 2001–2023 |