Thursday, January 19, 2006

Find the path to My Documents using VBScript

Set WshShell = Wscript.CreateObject("Wscript.Shell")
path=WshShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Personal")
Observe that it's Personal that keeps the path to My Documents. This works if the path is below C:\Documents and Settings\ or redirected to a server location like \\server\home$\Jimmy.Bergmark PS. to show code like above I've used HTML code like this. It's useful when the rows are long. Setting the height and width so it fits for the purpose.
<pre style="margin:0px; padding:6px; border:1px #666666 solid; width:600px; 
height:70px; overflow:auto"></pre>

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner