求一程序,修复我的快捷方式。。。

llydmissile 2010-08-04 11:07:39
前不久中毒了,快捷方式的.lnk文件都被改成了.yfiye 文件,用notepad打开内容如下


[360]
Found=All
Name=___C%3A%5CProgram%20Files%5Carswp3%5CArSwp3.exe___
Tel=<<<>>>
[InternetShortcut]
URL=http://www.baidu.com
IconIndex=0
IconFile=C:\Program Files\arswp3\ArSwp3.exe


可以看到原先的路径依然保留着因此可以修复,但是因为链接数量太多,人工修复工作量太大,求程序解决。。系统winxp
...全文
119 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
llydmissile 2010-08-08
  • 打赏
  • 举报
回复
解决了,多谢
drifter250771 2010-08-07
  • 打赏
  • 举报
回复
庞杂冗长的代码。。。
把C:\TEST目录改为自已需要的,存为VBS后运行


strPathName = "C:\TEST"
TranverseFile(strPathName)


Function ReadIni( myFilePath, mySection, myKey )
' This function returns a value read from an INI file
'
' Arguments:
' myFilePath [string] the (path and) file name of the INI file
' mySection [string] the section in the INI file to be searched
' myKey [string] the key whose value is to be returned
'
' Returns:
' the [string] value for the specified key in the specified section
'
' CAVEAT: Will return a space if key exists but value is blank
'
' Written by Keith Lacelle
' Modified by Denis St-Pierre and Rob van der Woude

Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8

Dim intEqualPos
Dim objFSO, objIniFile
Dim strFilePath, strKey, strLeftString, strLine, strSection

Set objFSO = CreateObject( "Scripting.FileSystemObject" )

ReadIni = ""
strFilePath = Trim( myFilePath )
strSection = Trim( mySection )
strKey = Trim( myKey )

If objFSO.FileExists( strFilePath ) Then
Set objIniFile = objFSO.OpenTextFile( strFilePath, ForReading, False )
Do While objIniFile.AtEndOfStream = False
strLine = Trim( objIniFile.ReadLine )

' Check if section is found in the current line
If LCase( strLine ) = "[" & LCase( strSection ) & "]" Then
strLine = Trim( objIniFile.ReadLine )

' Parse lines until the next section is reached
Do While Left( strLine, 1 ) <> "["
' Find position of equal sign in the line
intEqualPos = InStr( 1, strLine, "=", 1 )
If intEqualPos > 0 Then
strLeftString = Trim( Left( strLine, intEqualPos - 1 ) )
' Check if item is found in the current line
If LCase( strLeftString ) = LCase( strKey ) Then
ReadIni = Trim( Mid( strLine, intEqualPos + 1 ) )
' In case the item exists but value is blank
If ReadIni = "" Then
ReadIni = " "
End If
' Abort loop when item is found
Exit Do
End If
End If

' Abort if the end of the INI file is reached
If objIniFile.AtEndOfStream Then Exit Do

' Continue with next line
strLine = Trim( objIniFile.ReadLine )
Loop
Exit Do
End If
Loop
objIniFile.Close
Else
WScript.Echo strFilePath & " doesn't exists. Exiting..."
Wscript.Quit 1
End If
End Function





Function URLDecode(strURL)
Dim I

If InStr(strURL, "%") = 0 Then
URLDecode = strURL
Exit Function
End If

For I = 1 To Len(strURL)
If Mid(strURL, I, 1) = "%" Then
If Eval("&H" & Mid(strURL, I + 1, 2)) > 127 Then
URLDecode = URLDecode & Chr(Eval("&H" & Mid(strURL, I + 1, 2) & Mid(strURL, I + 4, 2)))
I = I + 5
Else
URLDecode = URLDecode & Chr(Eval("&H" & Mid(strURL, I + 1, 2)))
I = I + 2
End If
Else
URLDecode = URLDecode & Mid(strURL, I, 1)
End If
Next
End Function





Function CJ(FPath)
Dim A1,A2,A3(3)
A1 = Split(FPath,"\")
A3(0) = Left(FPath,Len(FPath)-1-Len(A1(UBound(A1))))
A3(1) = A1(UBound(A1))
A2 = Split(A3(1),".")
A3(2) = Left(A3(1),Len(A3(1))-1-Len(A2(UBound(A2))))
CJ = A3
End Function





Function TranverseFile(strPathName)
Set oFSO = CreateObject("scripting.filesystemobject")
Set WshShell = WScript.CreateObject("WScript.Shell")
Set oFolder = oFSO.GetFolder(strPathName)
Set oFiles = oFolder.Files
Dim FPath,OBJ1,OBJ2
For Each oFile In oFiles
If StrComp(LCase(oFSO.GetExtensionName(oFile)),"yfiye")=0 Then
FPath = ReadIni(oFile.Path,"360","Name")
IconIndex = ReadIni(oFile.Path,"InternetShortcut","IconIndex")
IconFile = ReadIni(oFile.Path,"InternetShortcut","IconFile")
FPath = URLDecode(FPath)
FPath = Mid(FPath,4,Len(FPath)-6)
OBJ1 = CJ(OFile.Path)
OBJ2 = CJ(FPath)
Set oShellLink = WshShell.CreateShortcut( OBJ1(0) & "\" & OBJ1(2) & ".lnk")
oShellLink.TargetPath = FPath
oShellLink.IconLocation = IconFile & "," & IconIndex
oShellLink.WorkingDirectory = OBJ2(0)
oShellLink.Save
End If
Next

Set oSubFolders = oFolder.subfolders

'Recurse the subFolder
For Each oSubFolder In oSubFolders
TranverseFile(oSubFolder)
Next

Set oFSO = Nothing
Set oFolder = Nothing
Set oSubFolder = Nothing
Set oSubFolders = Nothing
Set oFiles = Nothing
Set oFile = Nothing
End Function
xu1163 2010-08-07
  • 打赏
  • 举报
回复
用下windows清理助手
llydmissile 2010-08-06
  • 打赏
  • 举报
回复
真的没有办法么
llydmissile 2010-08-04
  • 打赏
  • 举报
回复
再贴一例
[360]
Found=All
Name=___C%3A%5CProgram%20Files%5CMozilla%20Firefox%5Cfirefox.exe___
Tel=<<<>>>
[InternetShortcut]
URL=http://www.baidu.com
IconIndex=0
IconFile=C:\Program Files\Mozilla Firefox\firefox.exe

“Name”是快捷方式目的路径,“IconFile”是图标路径
llydmissile 2010-08-04
  • 打赏
  • 举报
回复
额。。。那能否不改变链接文件,而是修改文件的打开方式,使这些快捷方式恢复使用啊
就是just4 2010-08-04
  • 打赏
  • 举报
回复
楼主先要注意两种快捷方式是不同的了,

程序的快捷方式打开是乱码的,而url快捷方式才是文件文件的,比如:


注意后缀不同,一个是lnk,一个是url,lnk是乱码,直接文本处理怎么修复呀?
llydmissile 2010-08-04
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 job82824 的回复:]
简单的算法就是枚举当前目录的.lnk文件(CFileFinder),然后删除掉前面的几行(就用CFile或者FILE都能完成的)。
[/Quote]
请您看清我的问题,目前我仅存的几个.lnk文件都是没有问题的,问题是很多.lnk文件被改成了.yfiye ,格式如上所述,我希望有程序能把这些改回标准的.lnk文件。

正常的lnk用notepad打开应该是类似这样的
L              F        掶%??+舠? 掶%??hU/                     P郞??i⒇ +00? /C:\                   J 1     ?g PROGRA~1  2   锞???g   P r o g r a m   F i l e s    J 1     ?b SOGOUE~1  2   锞?<t?b   S o g o u E x p l o r e r    V 2 hU/ ?糔  SOGOUE~1.EXE  :   锞?糔?@t   S o g o u E x p l o r e r . e x e      _            -       ^         }6    C:\Program Files\SogouExplorer\SogouExplorer.exe  6 . . \ . . \ . . \ P r o g r a m   F i l e s \ S o g o u E x p l o r e r \ S o g o u E x p l o r e r . e x e  C : \ P r o g r a m   F i l e s \ S o g o u E x p l o r e r      ?   w   `     燲       pc-200907121231 p兟垸?Hゅ摉儵踼撵漋^嬤 ??p兟垸?Hゅ摉儵踼撵漋^嬤 ??    
job82824 2010-08-04
  • 打赏
  • 举报
回复
简单的算法就是枚举当前目录的.lnk文件(CFileFinder),然后删除掉前面的几行(就用CFile或者FILE都能完成的)。

6,850

社区成员

发帖
与我相关
我的任务
社区描述
Windows 2016/2012/2008/2003/2000/NT
社区管理员
  • Windows Server社区
  • qishine
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧