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

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?

3,663 views 3 replies
Reply #1 Top

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.

+1 Loading…
Reply #2 Top

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.

Reply #3 Top

Martin,

 

 Nice to see you around again!