{"id":6743,"date":"2012-08-28T07:00:01","date_gmt":"2012-08-28T07:00:01","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2012\/08\/28\/command-line-tool-to-manage-windows-7-libraries-with-source-code\/"},"modified":"2012-08-28T07:00:01","modified_gmt":"2012-08-28T07:00:01","slug":"command-line-tool-to-manage-windows-7-libraries-with-source-code","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20120828-01\/?p=6743","title":{"rendered":"Command line tool to manage Windows 7 Libraries, with source code"},"content":{"rendered":"<p>\nA customer asked if there was a command-line tool for\nmanaging Windows&nbsp;7 Libraries\nso that they could create and deploy libraries across their\norganization.\n<\/p>\n<p>\nNot only is there such a tool, it even comes with source code.\n<\/p>\n<p>\nThe\n<a HREF=\"http:\/\/msdn.microsoft.com\/library\/dd940379\">\nShell Library Command Line Sample<\/a>\nshows how to manage Windows&nbsp;7 libraries programmatically\nvia the\n<code>IShell&shy;Library<\/code> interface.\nAnd it&#8217;s actually a useful program on its own.\n<\/p>\n<pre>\nUsage: shlib.exe SUBCOMMAND\nDisplays and modifies the attributes of Shell Libraries.\nSupported commands:\n  create      Creates a library at the specified path.\n  info        Prints info about the given library.\n  enum        Enumerates the folders in the library.\n  setattrib   Modifies the attributes of the library.\n  add         Adds the specified folder to the specified library.\n  remove      Removes the specified folder from the library.\n  setsaveloc  Sets the default save location of the library.\n  resolve     Resolves the specified folder in the library.\n  resolveall  Resolves all locations in the library in bulk.\n  manage      Displays the Manage Library Dialog for the library.\n<\/pre>\n<p>\nFor example, to see all the folders that are part of your Documents\nlibrary, use the command\n<\/p>\n<pre>\nshlib enum FOLDERID_DocumentsLibrary\n<\/pre>\n<p>\nEach of the commands has further sub-options.\n<\/p>\n<pre>\nUsage: create shlib.exe [OPTIONS]  [...]\nCreates a library at the specified path.\nOptions:\n -create[:ARG]       Specifies that a new library should be created.\n   &lt;none&gt;              Fail if the library already exists.\n   overwrite           Overwrite any existing library.\n   uniquename          Generate a unique name in case of conflict.\nThe library may be specified by a file system path,\nor by a KNOWNFOLDERID (e.g. \"FOLDERID_DocumentsLibrary\").\n<\/pre>\n<p>\nAnd the source code shows how to perform each of these actions\nprogrammatically.\n<\/p>\n<p>\nThe <code>IShellLibrary<\/code> interface is also supported by\nthe\n<a HREF=\"http:\/\/archive.msdn.microsoft.com\/WindowsAPICodePack\">\nWindows API Code Pack for .NET<\/a>,\nso you C# folks can use it too.\n<\/p>\n<p>\n(One thing I noticed that is missing from the sample is a\n<code>seticon<\/code> command.\nShouldn&#8217;t be hard to implement.\nYou just call\n<a HREF=\"http:\/\/msdn.microsoft.com\/library\/dd391729\">\n<code>IShell&shy;Library::Set&shy;Icon<\/code><\/a>.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A customer asked if there was a command-line tool for managing Windows&nbsp;7 Libraries so that they could create and deploy libraries across their organization. Not only is there such a tool, it even comes with source code. The Shell Library Command Line Sample shows how to manage Windows&nbsp;7 libraries programmatically via the IShell&shy;Library interface. And [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25,104],"class_list":["post-6743","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code","tag-tipssupport"],"acf":[],"blog_post_summary":"<p>A customer asked if there was a command-line tool for managing Windows&nbsp;7 Libraries so that they could create and deploy libraries across their organization. Not only is there such a tool, it even comes with source code. The Shell Library Command Line Sample shows how to manage Windows&nbsp;7 libraries programmatically via the IShell&shy;Library interface. And [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/6743","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=6743"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/6743\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=6743"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=6743"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=6743"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}