windows 从lnk恢复文件夹

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4474386/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 15:49:07  来源:igfitidea点击:

Restore folder from lnk

windowsvbscriptbatch-file

提问by Dario Dias

Some virus has named all the folders in the usb flash disk to foldername.lnk (the folder named games has been changed to games.lnk).Properties of the flash drive shows size of the folder as the disk space used.How do I restore the folder with batch file or vbscript?

有病毒把U盘里的所有文件夹都命名为foldername.lnk(游戏文件夹改成了games.lnk)。U盘属性显示文件夹大小为已用磁盘空间。如何恢复带有批处理文件或 vbscript 的文件夹?

回答by Javed Akram

Create a batch file and write this

创建一个批处理文件并写下这个

attrib -h -s -r \s \d

this will change attributes of all files and folders at current directory

这将更改当前目录中所有文件和文件夹的属性



Update:

更新:

The following vbScriptwill rename all folders having extension like folder_name.someExtensionand make them with previous names.

以下vbScript将重命名所有具有类似扩展名的文件夹,folder_name.someExtension并使用以前的名称进行命名。

create 2 files:
1. script.vbs
2. rename.bat

创建 2 个文件:
1.script.vbs
2.rename.bat

script.vbs

脚本.vbs

Set objFS = CreateObject("Scripting.FileSystemObject")
strFolder = objFS.GetAbsolutePathName(".")
Set objFolder = objFS.GetFolder(strFolder)

For Each Folder In objFolder.SubFolders
   Folder.Name=Mid(Folder.Name,1,InStrRev(Folder.Name,".")-1)
Next

rename.bat

重命名.bat

cscript /nologo script.vbs

Place them is same folder where changed folder are. And run the rename.batfile.

将它们放在更改文件夹所在的同一文件夹中。并运行该rename.bat文件。

and That's it.
Enjoy :)

就是这样。
享受 :)

回答by Marcelb

Using "attrib -h -s -r \s \d" immediately did the trick for me, except for one thing. The backslashes ( \ ) should both be forward slashes ( / ) So

除了一件事之外,使用“attrib -h -s -r \s \d”立即为我解决了问题。反斜杠 ( \ ) 都应该是正斜杠 ( / ) 所以

attrib -h -s -r /s /d

But nontheless, many thanks to the original poster of the solution, because it really helped me. I just thought i'd point it out for other people who might need to do this.

尽管如此,非常感谢解决方案的原始海报,因为它真的帮助了我。我只是想我会为可能需要这样做的其他人指出这一点。

回答by Mian Ateeque Ahmed Mekan

Take it easy,,,with easiest Steps :-

放轻松,,,用最简单的步骤:-

  1. Go to Control Panel

  2. Open Folder Options

  3. Go to "View" tab there

  4. Sub Menu> Hidden Files and Folders

  5. Tick the option i.e: Show hidden files and folders

  6. Apply and Click Ok

  7. Now Be Back to Hard Drive Containing Folders of .lnk extensions

  8. There you will see your original folders (dim lightning)

  9. Delete files/folders with .lnk extensions

  10. and enjoy with your original folders....!

  1. 进入控制面板

  2. 打开文件夹选项

  3. 转到那里的“查看”选项卡

  4. 子菜单>隐藏文件和文件夹

  5. 勾选选项即:显示隐藏的文件和文件夹

  6. 应用并单击确定

  7. 现在回到包含 .lnk 扩展名文件夹的硬盘驱动器

  8. 在那里你会看到你的原始文件夹(暗淡的闪电)

  9. 删除扩展名为 .lnk 的文件/文件夹

  10. 并享受您的原始文件夹......!

Hope this Helps...:-)

希望这可以帮助...:-)

回答by st0le

The Folders attributes must have been changed to Hidden+System+Readonly. Delete the links. And enable "View Hidden Files"and "View System Files"to view your folders.

文件夹属性必须已更改为Hidden+System+Readonly。删除链接。并启用"View Hidden Files""View System Files"查看您的文件夹。

Cheers!

干杯!