<s> import sys , os <EOL> from win32com . shell import shell , shellcon <EOL> import pythoncom <EOL> import glob <EOL> from win32com . storagecon import * <EOL> def DumpLink ( fname ) : <EOL> shellLink = pythoncom . CoCreateInstance ( shell . CLSID_ShellLink , None , pythoncom . CLSCTX_INPROC_SERVER , shell . IID_IShellLink ) <EOL> persistFile = shellLink . QueryInterface ( pythoncom . IID_IPersistFile ) <EOL> persistFile . Load ( fname , STGM_READ ) <EOL> shellLink . Resolve ( <NUM_LIT:0> , shell . SLR_ANY_MATCH | shell . SLR_NO_UI ) <EOL> fname , findData = shellLink . GetPath ( <NUM_LIT:0> ) <EOL> print "<STR_LIT>" , fname , "<STR_LIT>" , shellLink . GetPath ( shell . SLGP_UNCPRIORITY ) [ <NUM_LIT:0> ] <EOL> print "<STR_LIT>" , shellLink . GetDescription ( ) <EOL> print "<STR_LIT>" , shellLink . GetWorkingDirectory ( ) <EOL> print "<STR_LIT>" , shellLink . GetIconLocation ( ) <EOL> def FavDumper ( nothing , path , names ) : <EOL> for name in names : <EOL> print name , <EOL> try : <EOL> DumpLink ( name ) <EOL> except pythoncom . com_error : <EOL> print "<STR_LIT>" <EOL> def DumpFavorites ( ) : <EOL> favfold = str ( shell . SHGetSpecialFolderPath ( <NUM_LIT:0> , shellcon . CSIDL_FAVORITES ) ) <EOL> print "<STR_LIT>" , favfold <EOL> os . path . walk ( favfold , FavDumper , None ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> if len ( sys . argv ) > <NUM_LIT:1> : <EOL> for fspec in sys . argv [ <NUM_LIT:1> : ] : <EOL> files = glob . glob ( fspec ) <EOL> if files : <EOL> for file in files : <EOL> print file <EOL> DumpLink ( file ) <EOL> print <EOL> else : <EOL> print "<STR_LIT>" , fspec <EOL> else : <EOL> print "<STR_LIT>" <EOL> DumpFavorites ( ) </s>
