JScript File Exists (special folder)

Author Johnny Josefsson on March 13, 2012 | Print | Bookmark
/* type = 
AllUsersDesktop
AllUsersStartMenu
AllUsersPrograms
AllUsersStartup
Desktop
Favorites
Fonts
MyDocuments
NetHood
PrintHood
Programs
Recent
SendTo
StartMenu
Startup
Templates
*/
function TypeFileExists( type, name)
{
  var fso = new ActiveXObject("Scripting.FileSystemObject");
  var shl = WScript.CreateObject("WScript.Shell");
  var ssf = WshShell.SpecialFolders(type);
  
  if( fso.FileExists( ssf + "\\" + name ) )
  {
    return true;
  }
  else
    return false;
}

Was this article helpful?

Yes No

Category: Scripting, JScript

Last updated on March 13, 2012 with 1002 views