That should work or you could do:

Dim Shell
Dim DesktopDir
Set Shell = WScript.CreateObject("WScript.Shell")
DesktopDir =
Shell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\E
xplorer\Shell Folders\Desktop")
wscript.echo DesktopDir


This I believe will be more accurate whereas I have run into
situations where I rename an account (say Administrator)
and the user's folder in Documents and settings is still administrator
(or the domain administrator's account might be Administrator.000, or
in the case of my machine where I have moved the Documents and settings
folder to the D drive, etc...)


Hope this helps...

-Tim



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:bounce-nt2000-137542@;ls.swynk.com]On Behalf Of CHRIS H
Sent: Friday, October 25, 2002 10:35 AM
To: NT 2000 Discussions
Subject: Re: VB Scripting


Thanks Tim. I am trying to pick up vbscript and sometimes I dont even know
what to call what I want to do to search for the answer first before bugging
the list. I think I found a way to do it using this:

Dim Shell
Dim UsrName

Set Shell = WScript.CreateObject("WScript.Shell")
UsrName = Shell.ExpandEnvironmentStrings("%USERNAME%")

And then I can insert the UsrName variable where I need it. Seem correct?


----- Original Message -----
From: "Tim George" <[EMAIL PROTECTED]>
To: "NT 2000 Discussions" <[EMAIL PROTECTED]>
Sent: Friday, October 25, 2002 10:04 AM
Subject: RE: VB Scripting


> You'll probably have to pass it in as a command line parameter...
>
> However there may be APIs to return the current user's desktop
> directory...  For example I think the registry key
> HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell
> Folders
> will contain where the folder is and you can use registry
> commands like RegRead exposed in Wscript's Shell object to
> read it...
>
> -Tim
>
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:bounce-nt2000-137542@;ls.swynk.com]On Behalf Of CHRIS H
> Sent: Friday, October 25, 2002 9:33 AM
> To: NT 2000 Discussions
> Subject: Re: VB Scripting
>
>
> Can you use the %username% variable in a vbscript? I want to save the
> shortcut to the user's desktop so I pathed it like:
>
> c:\documents and settings\%username%\desktop\shortcut.lnk
>
> ----- Original Message -----
> From: "Tim George" <[EMAIL PROTECTED]>
> To: "NT 2000 Discussions" <[EMAIL PROTECTED]>
> Sent: Thursday, October 24, 2002 2:32 PM
> Subject: RE: VB Scripting
>
>
> > if launching directly doesn't work, you can always use the
> > CScript executable for a console type launch where messages
> > goes to the command window or WScript where messages appear
> > as message boxes (GUI)...
> >
> > -Tim
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:bounce-nt2000-137542@;ls.swynk.com]On Behalf Of CHRIS H
> > Sent: Thursday, October 24, 2002 2:29 PM
> > To: NT 2000 Discussions
> > Subject: VB Scripting
> >
> >
> > This is a newbie (and probably stupid) question as I am just getting
into
> VB
> > Scrtipting in my login scripts.
> > Can I call a vbs script from a batch file? I have WSH installed. Do you
> just
> > c:\filename.vbs or is there a certain syntax to call it?
> >
> > TIA!
> >
> > Chris
> >
> >
> > ------
> > You are subscribed as [EMAIL PROTECTED]
> > Archives: http://www.swynk.com/sitesearch/search.asp
> > To unsubscribe send a blank email to %%email.unsub%%
> >
> >
> > ------
> > You are subscribed as [EMAIL PROTECTED]
> > Archives: http://www.swynk.com/sitesearch/search.asp
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
> ------
> You are subscribed as [EMAIL PROTECTED]
> Archives: http://www.swynk.com/sitesearch/search.asp
> To unsubscribe send a blank email to %%email.unsub%%
>
>
> ------
> You are subscribed as [EMAIL PROTECTED]
> Archives: http://www.swynk.com/sitesearch/search.asp
> To unsubscribe send a blank email to %%email.unsub%%
>


------
You are subscribed as [EMAIL PROTECTED]
Archives: http://www.swynk.com/sitesearch/search.asp
To unsubscribe send a blank email to %%email.unsub%%


------
You are subscribed as [email protected]
Archives: http://www.swynk.com/sitesearch/search.asp
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to