高端响应式模板免费下载

响应式网页设计、开放源代码、永久使用、不限域名、不限使用次数

保留路径批量建立快捷方式

用wsh写了个,把下面的代码存为shortcut.js,然后运行shortcut.js x:\xxx y:\yyy就可以了,其中x:\xxx是文件所在目录,y是快捷方式所在路径

--------------------------------------------------------------------

//create shortcut from from,, to to....:)

var fso = new ActiveXObject("Scripting.FileSystemObject");

var shell = WScript.CreateObject("WScript.Shell");

var exp = new RegExp("\\.[^\\.]+$", "");

var objArgs = WScript.Arguments;

if (objArgs.length==2)

Shortcut(objArgs(0), objArgs(1));

else

WScript.Echo("Wrong arguments!\n\nUsage:\nshortcut.js d:\\a\\ d:\\b\\");

// launcher

function Shortcut(from, to){

if (fso.FolderExists(from)){

from = fso.GetFolder(from).Path;

Travel(from, from, to);

}else

WScript.Echo("Folder "+from+" doesn't exist!");

}

// create shortcut for fromFile in to folder

function CreateSC(fromFile, to){

var file = fso.GetFile(fromFile);

var link = shell.CreateShortcut(to + "\\"+file.name.replace(exp, "")+".lnk");

link.TargetPath = file.Path;

link.WorkingDirectory = file.Path.replace(file.name, "");

link.Save();

}

// build shortcut for all files in curFrom folder

function Travel(curFrom, from, to){

var curTo = curFrom.replace(from, to);

var fromFolder = fso.GetFolder(curFrom);

// create the to folder if not exist

if (!fso.FolderExists(curTo))

fso.CreateFolder(curTo);

// create shortcut for each file in current folder

var files = new Enumerator(fromFolder.files);

for (; !files.atEnd(); files.moveNext())

CreateSC(files.item().Path, curTo);

// travel to subfolders

var folders = new Enumerator(fromFolder.SubFolders);

for (; !folders.atEnd(); folders.moveNext())

Travel(folders.item().Path, from, to);

}

--------------------------------------------------------------------

win 2k/xp 下应没问题,如果无法执行,请到下面的地址下载wsh并安装之

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=C717D943-7E4B-4622-86EB-95A22B832CAA

不用付钱了,给分就好了,祝你好运^_^

猜你喜欢