Any way to access the Public folder (Vista) or Shared (XP)

Sunday, January 18, 2009 by sViz | Discussion: DesktopX

I'm looking for vbscript to access the Public folder in Vista. I'm using shell and enumeration of special folders, but haven't found any for public or shared.

Anyone have a workaround?

_Martin_
Reply #1 Wednesday, January 21, 2009 9:45 AM

You can use the below to detect Vista (and I'm sure Google will confirm the XP version), and then can you not go to the location directly? i.e. c:\users\public.

Code: vbscript
  1.  strComputer = "."
  2.  Set WshShell = CreateObject("WScript.Shell")
  3.  Dim WshShell
  4.  Set objWMIService = GetObject("winmgmts:" & _
  5.    "{impersonationLevel=impersonate}!\\" & strComputer & _
  6.    "\root\cimv2")
  7.  Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
  8.  For Each objOperatingSystem In colOperatingSystems
  9.    If Instr(objOperatingSystem.Caption, "Vista") > 0 Then
  10.     IsVista = True
  11.    End If
  12.  Next

Not many people change this location, and if you find (via vbscript) that the directory does not exist, you could prompt the user to locate it.

sViz
Reply #2 Thursday, January 22, 2009 8:45 AM

Thanks Martin.   I decided to go with the direct solution and prompt. Wanted to make the shortcuts with as little user configuration as possible, but I guess one or two prompts won't hurt.

RomanDA
Reply #3 Friday, January 23, 2009 8:52 AM

Martin,

 

 Nice to see you around again!

Please login to comment and/or vote for this skin.

Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:

  • Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
  • Access to a great community, with a massive database of many, many areas of interest.
  • Access to contests & subscription offers like exclusive emails.
  • It's simple, and FREE!



web-wc01