For Programmers: Free Programming Magazines  


Home > Archive > VBScript > November 2004 > Folder redirection









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Folder redirection
Kari V.

2004-11-22, 8:55 am

Hi,


How can I redirect My Pictures folder to network share, when I wan't to add
a folder after username. The script below does this redirection
\\server\share\USERNAME\
I would like to add a folder after ...\USERNAME\My Pictures , but I don't
know how?

Set oShell = CreateObject("WScript.Shell")
Set oNet = CreateObject("WScript.Network")
sUser = oNet.UserName
sMyPicPath = ("\\server\share\" & sUser)
Set oShell = CreateObject("WScript.Shell")
oShell.RegWrite " HKCU\Software\Microsoft\Windows\CurrentV
ersion\" _
& "Explorer\Shell Folders\My Pictures", sMyPicPath, "REG_SZ"
oShell.RegWrite " HKCU\Software\Microsoft\Windows\CurrentV
ersion\" _
& "Explorer\User Shell Folders\My Pictures", sMyPicPath, "REG_SZ"

Thanks.

Kari V.
Matthias Tacke

2004-11-22, 8:55 am

Kari V. schrieb:
> How can I redirect My Pictures folder to network share, when I wan't to add
> a folder after username. The script below does this redirection
> \\server\share\USERNAME\
> I would like to add a folder after ...\USERNAME\My Pictures , but I don't
> know how?

Hi Kari,
If I understand right simply append following the username.
If the user folder remains at the standard position it might be
a good idea to replace the "My Pictures" folder there with a
shortcut to the server share.
>
> Set oShell = CreateObject("WScript.Shell")
> Set oNet = CreateObject("WScript.Network")
> sUser = oNet.UserName
> sMyPicPath = ("\\server\share\" & sUser)

sMyPicPath = ("\\server\share\" & sUser & "My Pictures")


> Set oShell = CreateObject("WScript.Shell")
> oShell.RegWrite " HKCU\Software\Microsoft\Windows\CurrentV
ersion\" _
> & "Explorer\Shell Folders\My Pictures", sMyPicPath, "REG_SZ"
> oShell.RegWrite " HKCU\Software\Microsoft\Windows\CurrentV
ersion\" _
> & "Explorer\User Shell Folders\My Pictures", sMyPicPath, "REG_SZ"
>

HTH

--
Gruesse Greetings Saludos Saluti Salutations
Matthias
---------+---------+---------+---------+---------+---------+---------+
Kari V.

2004-11-22, 8:55 am

Thanks Matthias,

It allmost did the job, but I need "\" before My Documents
like this: \\server\share\USERNAME\My Pictures
Your script
sMyPicPath = ("\\server\share\" & sUser & "My Pictures")
did do this
\\server\share\USERNAMEMy Pictures

Kari V.

"Matthias Tacke" wrote:

> Kari V. schrieb:
> Hi Kari,
> If I understand right simply append following the username.
> If the user folder remains at the standard position it might be
> a good idea to replace the "My Pictures" folder there with a
> shortcut to the server share.
> sMyPicPath = ("\\server\share\" & sUser & "My Pictures")
>
>
> HTH
>
> --
> Gruesse Greetings Saludos Saluti Salutations
> Matthias
> ---------+---------+---------+---------+---------+---------+---------+
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com