标题: [技术讨论] 回报批处理之家---VBS处理 unicode、inf文件回帖 [打印本页]
作者: yuanyannian 时间: 2014-11-22 11:44 标题: 回报批处理之家---VBS处理 unicode、inf文件回帖
本帖是本人对批处理之家的回报贴。即,将近一段时期本人求助并得以解决的成熟代码汇报给论坛,本人不可独享,留存在论坛中,以提供给需要者。
这些代码主要是针对 Unicode 格式的 INF 文件的处理。
感谢批处理之家提供的平台,使得相应问题能够得以圆满解决。
再次感谢 apang 等老师的无私相助。
1. 接收外部参数,查找替换- Dim msg1, msg2, fso, ws, oArgs, iPath, tPath, sLoca, sPName, tPName
- msg1 = "HojoHE.exe -Sdefault -ID:\a -TE:\a\b -L00000409"
- msg2 = "HojoUE.exe -SC:\def.reg -TD:\sft.reg"
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set ws = CreateObject("WScript.Shell")
- Set oArgs = WScript.Arguments
- If oArgs.Count >= 4 Then
- If (Left(oArgs(0),2) = "-S") and (Left(oArgs(1),2) = "-I") and (Left(oArgs(2),2) = "-T") and (Left(oArgs(3),2) = "-L") Then
- iPath = Mid(oArgs(1), 3) & "\"
- tPath = Mid(oArgs(2), 3) & "\"
- sLoca = Mid(oArgs(3), 3)
- Call HojoHE()
- Else MsgBox "usage:" & vbLf & vbLf & msg1
- End If
- ElseIf oArgs.Count = 2 Then
- If Left(oArgs(0),2) = "-S" and (Left(oArgs(1),2) = "-T") Then
- sPName = Mid(oArgs(0), 3)
- tPName = Mid(oArgs(1), 3)
- Call ChangeRegFile()
- Else MsgBox "usage:" & vbLf & vbLf & msg2 : WScript.Quit
- End If
- Else MsgBox "usage:" & vbLf & vbLf & msg1 & vbLf & "or" & vbLf & msg2 : WScript.Quit
- End If
-
- Function HojoHE()
- On Error Resume Next
- Dim ar, i
- If Not fso.FolderExists(tPath) Then fso.CreateFolder tPath
- Select Case LCase(Mid(oArgs(0), 3))
- Case "default"
- fso.CopyFile iPath & "HIVEDEF.INF", tPath, true
- Call ProcessFile(tPath & "HIVEDEF.INF", "default")
- Case "software"
- ar = Array("HIVESFT","HIVECLS","HIVESXS","HIVCLS32","HIVSFT32","DMREG")
- For i = 0 to UBound(ar)
- fso.CopyFile iPath & ar(i) & ".INF", tPath, true
- Call ProcessFile(tPath & ar(i) & ".INF", "software")
- Next
- Case "setupreg.hiv"
- ar = Array("HIVESYS","INTL")
- For i = 0 to UBound(ar)
- fso.CopyFile iPath & ar(i) & ".INF", tPath, true
- Call ProcessFile(tPath & ar(i) & ".INF", "setup")
- Next
- Case Else MsgBox "The parameter isn't supported!" & vbLf & vbLf & "Must be 'default', or 'software', or 'setupreg.hiv'." : WScript.Quit
- WScript.Quit
- End Select
- End Function
-
- Function ChangeRegFile()
- Dim f, txt, re, m, s1, s2, s
- Set f = fso.OpenTextFile(sPName, 1, , -1)
- txt = f.ReadAll : f.Close
- Set re = New RegExp
- re.Pattern = "([\s\S]*?)(^"".+"" *=[\s\S]+?)(?=^"")"
- re.Global = true
- re.IgnoreCase = true
- re.MultiLine = true
- For Each m in re.Execute(txt & vbCrLf & """")
- s1 = m.SubMatches(0)
- s2 = ReReplace(m.SubMatches(1))
- If m.SubMatches(1) <> s2 Then
- s = s & s1 & s2
- Else s = s & s1
- End If
- Next
- s1 = "25,00,41,00,4c,00,4c,00,55,00,53,00,45,00,52,00,53,00,"
- re.Pattern = "(hex\(2\):)25,00,55,00,53,00,45,00,52,00,"
- s = re.Replace(s, "$1" & s1)
- re.Pattern = "WB-default\\Software"
- s = re.Replace(s, "WB-software")
- fso.OpenTextFile(tPName, 2, true, -1).Write s
- End Function
-
- Function ProcessFile(infFile, hivFile)
- Dim f, s, lgInst, yn
- Set f = fso.OpenTextFile(infFile, 1, false, GetFileFormat(infFile))
- s = f.ReadAll : f.Close
- s = ReplaceStr(s, "HKCU, *""", "HKLM,""WB-default\")
- s = ReplaceStr(s, "HKLM, *""SYSTEM\\CurrentControlSet", "HKLM,""WB-setup\ControlSet001")
- s = ReplaceStr(s, "HKLM, *""SYSTEM\\", "HKLM,""WB-setup\")
- s = ReplaceStr(s, "HKLM, *SYSTEM\\CurrentControlSet", "HKLM,WB-setup\ControlSet001")
- s = ReplaceStr(s, "HKLM, *SYSTEM\\", "HKLM,WB-setup\")
- s = ReplaceStr(s, "\\CryptSvc\\Security"",""Security"",0x00030003, *\\", "\CryptSvc\Security"",""Security"",0x00030003,00")
- s = ReplaceStr(s, "HKLM, *""SOFTWARE\\", "HKLM,""WB-software\")
- s = ReplaceStr(s, "HKLM, *SOFTWARE\\", "HKLM,WB-software\")
- s = ReplaceStr(s, "HKCR, *""", "HKLM,""WB-software\Classes\")
- s = ReplaceStr(s, "HKCR,\.", "HKLM,WB-software\Classes\.")
- If UCase(infFile) = UCase(tPath & "INTL.INF") Then
- s = ReplaceStr(s, "\[" & sLoca & "\]", "[DefaultInstall]")
- s = ReplaceStr(s, "CopyFile", ";CopyFile")
- lgInst = Split(ProssLocales(s), ",")
- s = ReplaceStr(s, "\[LG_INSTALL_(" & lgInst(0) & "|" & lgInst(1) & ")]", "[DefaultInstall]")
- ElseIf Left(s, 16) <> "[DefaultInstall]" Then
- s = "AddReg = AddReg.Upgrade" & vbCrLf & s
- s = "AddReg = AddReg.Fresh" & vbCrLf & s
- s = "AddReg = AddReg.RemoteBoot" & vbCrLf & s
- s = "AddReg = AddReg" & vbCrLf & s
- s = "[DefaultInstall]" & vbCrLf & s
- End If
- fso.OpenTextFile(infFile, 2, true, -1).Write s
- On Error Resume Next
- yn = ws.RegRead("HKEY_LOCAL_MACHINE\WB-" & hivFile & "\")
- If yn <> 0 Then
- infFile = fso.GetFile(infFile).ShortPath
- ws.Run "rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 132 " & infFile, , true
- Else MsgBox "Error, the WB-" & hivFile & " not found and exit." : WScript.Quit
- End If
- End Function
-
- Function GetFileFormat(ByVal infFile)
- Dim Bin
- with CreateObject("Adodb.Stream")
- .Type = 1
- .Mode = 3
- .Open
- .Position = 0
- .Loadfromfile infFile
- Bin = .read(2)
- End with
- If AscB(MidB(Bin,1,1))=&HFF and AscB(MidB(Bin,2,1))=&HFE Then
- GetFileFormat = -1 ''unicode
- Else GetFileFormat = 0 ''ansi
- End If
- End Function
-
- Function ReplaceStr(ByVal s, pattern, s1)
- Dim re
- Set re = New RegExp
- re.Pattern = pattern
- re.Global = true
- re.IgnoreCase = true
- ReplaceStr = re.Replace(s, s1)
- End Function
-
- Function ProssLocales(ByVal s)
- Dim pattern1, pattern2, re, m
- pattern1 = "^ *\[Locales] *$"
- pattern2 = "^ *" & sLoca & " *=([^,]*,){2}([^,]*,[^,]*),.*$"
- Set re = New RegExp
- re.Pattern = pattern1 & "[\s\S]*?" & pattern2
- re.IgnoreCase = true
- re.MultiLine = true
- For Each m in re.Execute(s)
- ProssLocales = m.SubMatches(1)
- Next
- End Function
-
- Function ReReplace(str)
- Dim re, p
- p = "Programs|Start Menu|Desktop|Startup|AppData|Templates|Favorites"
- Set re = New RegExp
- re.Pattern = """(" & p & ")"""
- re.IgnoreCase = true
- ReReplace = re.Replace(str, """Common $1""")
- End Function
复制代码
2. 内部变量查找,写入 reg 文件- Dim msg, ws, oArgs, sName, sPath, tPath
- msg = "HojoRV.exe -SN""HIVESFT.INF"" -TN""Revise.reg"" -SP""D:\a"" -TP""E:\aa\bb"""
- Set ws = CreateObject("WScript.Shell")
- Set oArgs = WScript.Arguments
- If oArgs.Count = 4 Then
- If (Left(oArgs(0),3) = "-SN") and (Left(oArgs(1),3) = "-TN") and (Left(oArgs(2),3) = "-SP") and (Left(oArgs(3),3) = "-TP") Then
- sName = UCase(Mid(oArgs(0), 4))
- tName = UCase(Mid(oArgs(1), 4))
- sPath = UCase(Mid(oArgs(2), 4)) & "\"
- tPath = UCase(Mid(oArgs(3), 4)) & "\"
- Else MsgBox "Usage:" & vbLf & vbLf & msg : WScript.Quit
- End If
- Else MsgBox "Usage:" & vbLf & vbLf & msg : WScript.Quit
- End If
-
- Dim sR, strSection, arField, arValue, arPath
- sR = "HKEY_LOCAL_MACHINE\"
- strSection = "Strings"
-
- If sName = "WIN95UPG.INF" Then
- arField = Array("BIOS","FLOP","ISAPNP","MF","MONITOR","NETWORK","PCI","ROOT","SCSI","VIRTUAL","PCMCIA","MCA")
- arValue = Array("@", "@", "@", """yyn1""", """yyn2""", """yyn3""", """yyn4""", """yyn5""", """wwwwwwwww""", """sssssssssss""", """wwww_ddd", """yyn6""")
- arPath = Array(sR&"pe-soft\yyn\Desktop", sR&"pe-soft\yyn\Test", sR&"pe-soft\yyn\Test\yyn", sR&"pe-soft\yyn\www", sR&"pe-soft\yyn\Test\rrr", sR&"pe-soft\yyn\trtr\trtr", _
- sR&"pe-soft\yyn\Test\yyn\ddd", sR&"pe-soft\yyn\ddddd", sR&"pe-soft\yyn\Test\yyn\fgfg", sR&"pe-soft\yyn\Test\uiuiu", sR&"pe-soft\yyn\Test\yyn\kkkk", sR&"pe-soft\yyn\ghghg")
- End If
-
- If sName = "HIVESFT.INF" Then
- arField = Array("BIOS","FLOP","ISAPNP","MF","MONITOR","NETWORK","PCI","ROOT","SCSI","VIRTUAL","PCMCIA","MCA")
- arValue = Array("@", "@", "@", """yyn1""", """yyn2""", """yyn3""", """yyn4""", """yyn5""", """wwwwwwwww""", """sssssssssss""", """wwww_ddd", """yyn6""")
- arPath = Array(sR&"pe-soft\yyn\Desktop", sR&"pe-soft\yyn\Test", sR&"pe-soft\yyn\Test\yyn", sR&"pe-soft\yyn\www", sR&"pe-soft\yyn\Test\rrr", sR&"pe-soft\yyn\trtr\trtr", _
- sR&"pe-soft\yyn\Test\yyn\ddd", sR&"pe-soft\yyn\ddddd", sR&"pe-soft\yyn\Test\yyn\fgfg", sR&"pe-soft\yyn\Test\uiuiu", sR&"pe-soft\yyn\Test\yyn\kkkk", sR&"pe-soft\yyn\ghghg")
- End If
-
- Dim fso, txt, re, i, regData
- Set fso = CreateObject("Scripting.FileSystemObject")
- txt = fso.OpenTextFile(sPath & sName, 1, false, -1).ReadAll
- txt = txt & vbCrLf & "["
- Set re = New RegExp
- re.Pattern = "^ *\[" & strSection & "] *$[\s\S]*?(?=^ *\[)"
- re.IgnoreCase = true
- re.Global = true
- re.MultiLine = true
- If Not re.Test(txt) Then WScript.Quit
- txt = re.Execute(txt)(0)
- For i = 0 to UBound(arField)
- re.Pattern = "^ *" & arField(i) & " *= *([^\r\n]+)"
- '' re.Pattern = "^ *" & arField(i) & " *= *(.*)"
- If re.Test(txt) Then
- regData = re.Execute(txt)(0).SubMatches(0)
- regData = chr(34) & Replace(regData, chr(34), "") & chr(34)
- s = s & "[" & arPath(i) & "]" & vbCrLf
- s = s & arValue(i) & "=" & regData & vbCrLf
- s = s & vbCrLf
- End If
- Next
- s = "Windows Registry Editor Version 5.00" & vbCrLf & vbCrLf & s
- fso.OpenTextFile(tPath & tName, 2, true, -1).Write s
复制代码
3. 快捷方式建立,更改文件及文件夹属性- Dim oArgs, sType, sName, sPathA, sPathB, sPathC, sDest
- Msg1 = "ShortcutBuild.exe -ST[Shortcut Type] -SN[Shortcut Name] -PA[Users Path] -PB[Icon Path] -PC[Target Path] -D[Desript]"
- Msg2 = "Shortcut Type: Desktop/StartMenu/Programs/QuickLaunch/Accessories"
- Set oArgs = WScript.Arguments
- If oArgs.Count >= 6 Then
- If Left(oArgs(0),3) = "-ST" and (Left(oArgs(1),3) = "-SN") and (Left(oArgs(2),3) = "-PA") and (Left(oArgs(3),3) = "-PB") and _
- (Left(oArgs(4),3) = "-PC") and (Left(oArgs(5),2) = "-D") Then
- sType = Mid(oArgs(0), 4)
- sName = Mid(oArgs(1), 4)
- sPathA = Mid(oArgs(2), 4)
- sPathB = Mid(oArgs(3), 4)
- sPathC = Mid(oArgs(4), 4)
- sDest = Mid(oArgs(5), 3)
- Else MsgBox "Usage:"& vbcrlf & vbcrlf & Msg1 & vbcrlf & Msg2 : WScript.Quit
- End If
- Else MsgBox "Usage:"& vbcrlf & vbcrlf & Msg1 & vbcrlf & Msg2 : WScript.Quit
- End If
-
- Dim fso, stPath, stName, menuPath, progPath, progName
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set WshShell = WScript.CreateObject("WScript.Shell")
- Select Case LCase(Mid(oArgs(0), 4))
- Case "desktop"
- stPath = sPathA & "\Users\Default\desktop"
- stName = "LocalizedResourceName=@X:\WXPE\System32\shell32.dll,-21769"
- Call ProcessShortcut()
- Case "programs"
- menuPath = sPathA & "\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu"
- menuName = "LocalizedResourceName=@X:\WXPE\System32\shell32.dll,-21786"
- stPath = sPathA & "\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs"
- stName = "LocalizedResourceName=@X:\WXPE\System32\shell32.dll,-21782"
- Call ProcessShortcut()
- Case "accessories"
- menuPath = sPathA & "\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu"
- menuName = "LocalizedResourceName=@X:\WXPE\System32\shell32.dll,-21786"
- progPath = sPathA & "\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs"
- progName = "LocalizedResourceName=@X:\WXPE\System32\shell32.dll,-21782"
- stPath = sPathA & "\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories"
- stName = "LocalizedResourceName=@X:\WXPE\System32\shell32.dll,-21761"
- Call ProcessShortcut()
- Case "administrativetools"
- menuPath = sPathA & "\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu"
- menuName = "LocalizedResourceName=@X:\WXPE\System32\shell32.dll,-21786"
- progPath = sPathA & "\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs"
- progName = "LocalizedResourceName=@X:\WXPE\System32\shell32.dll,-21782"
- stPath = sPathA & "\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Administrative Tools"
- stName = "LocalizedResourceName=@X:\WXPE\System32\shell32.dll,-21762"
- Call ProcessShortcut()
- Case "startmenu"
- stPath = sPathA & "\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu"
- Call ProcessShortcut()
- Case "taskbar"
- stPath = sPathA & "\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
- Call ProcessShortcut()
- Case Else
- MsgBox "Usage:" & vbLf & vbLf & Msg2 : WScript.Quit
- End Select
-
- Function ProcessShortcut()
- Dim sla, getPath, newPath, workPath, lnkFile
- sla = "\"
- getPath = split(stPath, sla)
- For i = 1 to Ubound(getPath)
- newPath = newPath & sla & getPath(i)
- If Not fso.FolderExists(getPath(0) & sla & newPath) Then
- fso.CreateFolder(getPath(0) & sla & newPath)
- End If
- Next
- Set oShellLink = WshShell.CreateShortcut(stPath & "\" & sName & ".lnk")
- oShellLink.IconLocation = sPathB
- oShellLink.TargetPath = sPathC
- If LCase(Mid(oArgs(1), 4)) = "windows explorer" Then
- workPath = ""
- Else workPath = "%HOMEDRIVE%%HOMEPATH%"
- End If
- oShellLink.WorkingDirectory = workPath
- oShellLink.WindowStyle = 1
- oShellLink.Description = sDest
- lnkFile = stPath & "\" & sName & ".lnk"
- If fso.FileExists(lnkFile) Then
- Call ProcessDesktop()
- Else
- oShellLink.Save
- Call ProcessDesktop()
- End if
- End Function
-
- Function ProcessDesktop()
- Dim iniFile, locName, fi
- iniFile = stPath & "\" & "desktop.ini"
- If LCase(sName) = "windows explorer" Then locName = "Windows Explorer.lnk=@X:\WXPE\system32\shell32.dll,-22067"
- If LCase(sName) = "command prompt" Then locName = "Command Prompt.lnk=@X:\WXPE\system32\shell32.dll,-22022"
- If LCase(sName) = "notepad" Then locName = "Notepad.lnk=@X:\WXPE\system32\shell32.dll,-22051"
- If LCase(sName) = "regedit" Then locName = "Regedit.lnk=@X:\WXPE\regedit.exe,-16"
- If LCase(sName) = "remote desktop connection" Then locName = "Remote Desktop Connection.lnk=@X:\WXPE\system32\mstsc.exe,-4000"
- If LCase(sName) = "wordpad" Then locName = "Wordpad.lnk=@X:\WXPE\system32\shell32.dll,-22069"
- If LCase(sName) = "calculator" Then locName = "Calculator.lnk=@X:\WXPE\system32\shell32.dll,-22019"
- If LCase(sName) = "mspaint" Then locName = "Mspaint.lnk=@X:\WXPE\system32\shell32.dll,-22054"
- If LCase(sName) = "component services" Then locName = "Component Services.lnk=@X:\WXPE\system32\comres.dll,-3410"
- If LCase(sName) = "computer management" Then locName = "Computer Management.lnk=@X:\WXPE\system32\mycomput.dll,-300"
- If LCase(sName) = "services" Then locName = "services.lnk=@X:\WXPE\system32\filemgmt.dll,-2204"
- If LCase(sName) = "event viewer" Then locName = "Event Viewer.lnk=@X:\WXPE\system32\shell32.dll,-22029"
- If LCase(sName) = "disk management" Then locName = "Disk management.lnk=@X:\WXPE\system32\dmdskres.dll,-1003"
- If LCase(sName) = "device management" Then locName = "Device management.lnk=@X:\WXPE\system32\devmgr.dll,-4"
- If LCase(sName) = "task management" Then locName = "Task management.lnk=@X:\WXPE\system32\taskmgr.exe,-32420"
- If Not LCase(sType) = "desktop" Then
- If Not LCase(sType) = "startmenu" Then
- If Not LCase(sType) = "taskbar" Then Call ProcessMdesktop()
- End If
- End If
- If fso.FileExists(iniFile) Then
- Const ForAppending = 8
- Set fi = fso.OpenTextFile(iniFile, ForAppending)
- If Not LCase(sType) = "startmenu" Then
- If Not LCase(sType) = "taskbar" Then
- If InStr(fso.OpenTextFile(iniFile).ReadAll(), "[.ShellClassInfo]") = 0 Then fi.WriteLine("[.ShellClassInfo]")
- If InStr(fso.OpenTextFile(iniFile).ReadAll(), stName) = 0 Then fi.WriteLine(stName)
- End If
- End If
- If InStr(fso.OpenTextFile(iniFile).ReadAll(), "[LocalizedFileNames]") = 0 Then fi.WriteLine("[LocalizedFileNames]")
- If InStr(fso.OpenTextFile(iniFile).ReadAll(), locName) = 0 Then fi.WriteLine(locName)
- fi.Close
- Else
- Set fi = fso.CreateTextFile(iniFile, True)
- If Not LCase(sType) = "startmenu" Then
- If Not LCase(sType) = "taskbar" Then
- fi.WriteLine("[.ShellClassInfo]")
- fi.WriteLine(stName)
- End If
- End If
- fi.WriteLine("[LocalizedFileNames]")
- fi.WriteLine(locName)
- fi.Close
- End If
- Call ProcessAttrib()
- End Function
-
- Function ProcessMdesktop()
- Dim piniFile, fprog, miniFile, fmenu
- If Not LCase(sType) = "programs" Then
- piniFile = progPath & "\" & "desktop.ini"
- If fso.FileExists(piniFile) Then
- Const ForAppending = 8
- Set fprog = fso.OpenTextFile(piniFile, ForAppending)
- If InStr(fso.OpenTextFile(piniFile).ReadAll(), "[.ShellClassInfo]") = 0 Then fprog.WriteLine("[.ShellClassInfo]")
- If InStr(fso.OpenTextFile(piniFile).ReadAll(), progName) = 0 Then fprog.WriteLine(progName)
- fprog.Close
- Else
- Set fprog = fso.CreateTextFile(piniFile, True)
- fprog.WriteLine("[.ShellClassInfo]")
- fprog.WriteLine(progName)
- fprog.Close
- End If
- End If
- miniFile = menuPath & "\" & "desktop.ini"
- If fso.FileExists(miniFile) Then
- Set fmenu = fso.OpenTextFile(miniFile, ForAppending)
- If InStr(fso.OpenTextFile(miniFile).ReadAll(), "[.ShellClassInfo]") = 0 Then fmenu.WriteLine("[.ShellClassInfo]")
- If InStr(fso.OpenTextFile(miniFile).ReadAll(), menuName) = 0 Then fmenu.WriteLine(menuName)
- fmenu.Close
- Else
- Set fmenu = fso.CreateTextFile(miniFile, True)
- fmenu.WriteLine("[.ShellClassInfo]")
- fmenu.WriteLine(menuName)
- fmenu.Close
- End If
- End Function
-
- Function ProcessAttrib()
- Dim fst, fstP, menuIni, menuP, progIni, progP
- Set fst = fso.GetFile(stPath & "\" & "desktop.ini")
- fst.Attributes = 2
- Set fstP = fso.GetFolder(stPath)
- If fstP.Attributes = 16 Then
- fstP.Attributes = 16+4
- End If
- If LCase(sType) = "programs" Then
- Set menuIni = fso.GetFile(menuPath & "\" & "desktop.ini")
- menuIni.Attributes = 2
- Set menuP = fso.GetFolder(menuPath)
- If menuP.Attributes = 16 Then
- menuP.Attributes = 16+4
- End If
- End If
- If LCase(sType) = "accessories" Then
- Set progIni = fso.GetFile(progPath & "\" & "desktop.ini")
- progIni.Attributes = 2
- Set progP = fso.GetFolder(progPath)
- If progP.Attributes = 16 Then
- progP.Attributes = 16+4
- End If
- Set menuIni = fso.GetFile(menuPath & "\" & "desktop.ini")
- menuIni.Attributes = 2
- Set menuP = fso.GetFolder(menuPath)
- If menuP.Attributes = 16 Then
- menuP.Attributes = 16+4
- End If
- End If
- If LCase(sType) = "administrativetools" Then
- Set progIni = fso.GetFile(progPath & "\" & "desktop.ini")
- progIni.Attributes = 2
- Set progP = fso.GetFolder(progPath)
- If progP.Attributes = 16 Then
- progP.Attributes = 16+4
- End If
- Set menuIni = fso.GetFile(menuPath & "\" & "desktop.ini")
- menuIni.Attributes = 2
- Set menuP = fso.GetFolder(menuPath)
- If menuP.Attributes = 16 Then
- menuP.Attributes = 16+4
- End If
- End If
- End Function
复制代码
作者: ygqiang 时间: 2014-11-28 23:47
本帖是本人对批处理之家的回报贴。即,将近一段时期本人求助并得以解决的成熟代码汇报给论坛,本人不可独享 ...
yuanyannian 发表于 2014-11-22 11:44
你的vbs代码,到底是实现啥功能的?
作者: g495326 时间: 2014-12-29 09:04
您的技术确实得到了提高。
我认为不写用法和注释的代码称不上回报贴。
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |