Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>@crono, I think wich your best option is add a reference to the COM library "Microsoft Shell Control And Automation" and use the <a href="http://msdn.microsoft.com/en-us/library/bb774094%28VS.85%29.aspx" rel="nofollow noreferrer">Shell32.Shell</a> object. and then enumerate the shortcuts and set the file atributes (FileAttributes.Hidden) of the shortcuts. </p> <p>check these links for more info.</p> <ul> <li><a href="http://msdn.microsoft.com/en-us/library/bb787810%28VS.85%29.aspx" rel="nofollow noreferrer">FolderItem Object</a></li> <li><a href="http://msdn.microsoft.com/en-us/library/bb774004%28VS.85%29.aspx" rel="nofollow noreferrer">ShellLinkObject Object</a></li> </ul> <p>see this simple example, is not complete, is just a draft.</p> <pre><code> using System; using System.Collections.Generic; using System.Text; using System.IO; using Shell32; //"Microsoft Shell Control And Automation" namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Shell32.Shell oShell; Shell32.Folder oFldr; oShell = new Shell32.Shell(); oFldr = oShell.NameSpace(Shell32.ShellSpecialFolderConstants.ssfDESKTOP);//point to the desktop foreach ( Shell32.FolderItem oFItm in oFldr.Items()) //get the shotrcuts { if (oFItm.IsLink) { Console.WriteLine("{0} {1} ", oFItm.Name, oFItm.Path); bool isArchive = ((File.GetAttributes(oFItm.Path) &amp; FileAttributes.Archive) == FileAttributes.Archive); //bool isHidden = ((File.GetAttributes(oFItm.Path) &amp; FileAttributes.Hidden) == FileAttributes.Hidden); if (isArchive) //Warning, here you must define the condition for hide the shortcut. in this case only check if has set the Archive atribute. { //Now you can set FileAttributes.Hidden atribute //File.SetAttributes(oFItm.Path, File.GetAttributes(oFItm.Path) | FileAttributes.Hidden); } } else { Console.WriteLine("{0} {1} ", oFItm.Name, oFItm.Path); } } Console.ReadKey(); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload