hi,

could anyone tell me how to read the USERNAME variable from a local machine.

I want to read the currently logged on username, and from there use that
name in the script.

ben

Re: environment variables by JR

JR
Tue Dec 30 05:39:01 CST 2003

this must be it

in VB User = Environ("UserName")

in VBS
set nw = createobject("wscript.network")
User = nw.username

folders can you find here
set wshshell = wscript.createobject("wscript.shell")
wshshell.specialfolders("AllUsersProgram")
wshshell.specialfolders("AllUsersstartMenu")
wshshell.specialfolders("AllUsersStartup")
wshshell.specialfolders("Desktop")


--
Met vriendelijke groeten.
Jan
"ben" <ben@mc.com> schreef in bericht
news:u$i6gLszDHA.2440@TK2MSFTNGP12.phx.gbl...
> hi,
>
> could anyone tell me how to read the USERNAME variable from a local
machine.
>
> I want to read the currently logged on username, and from there use that
> name in the script.
>
> ben
>
>



Re: environment variables by ben

ben
Tue Dec 30 07:01:52 CST 2003

Jan,

thanks for that. that works now... i am trying to get the special folders.
the AllUsersProgram doesn't work.

any ideas on what i am doing wrong..

ben
"JR" <XXX.X@pandora.XXXX> wrote in message
news:ptdIb.104667$uS1.4662339@phobos.telenet-ops.be...
> this must be it
>
> in VB User = Environ("UserName")
>
> in VBS
> set nw = createobject("wscript.network")
> User = nw.username
>
> folders can you find here
> set wshshell = wscript.createobject("wscript.shell")
> wshshell.specialfolders("AllUsersProgram")
> wshshell.specialfolders("AllUsersstartMenu")
> wshshell.specialfolders("AllUsersStartup")
> wshshell.specialfolders("Desktop")
>
>
> --
> Met vriendelijke groeten.
> Jan
> "ben" <ben@mc.com> schreef in bericht
> news:u$i6gLszDHA.2440@TK2MSFTNGP12.phx.gbl...
> > hi,
> >
> > could anyone tell me how to read the USERNAME variable from a local
> machine.
> >
> > I want to read the currently logged on username, and from there use that
> > name in the script.
> >
> > ben
> >
> >
>
>



Re: environment variables by JR

JR
Tue Dec 30 11:03:15 CST 2003

fom of the specialfolders don't work on all operating systems
try out what you can find
with the code for

each F in wshshell.specialfolders
msgbox F
next
I didn't found a good description of them all

the VBS-help gives this

The following special folders are available:

a.. AllUsersDesktop
b.. AllUsersStartMenu
c.. AllUsersPrograms
d.. AllUsersStartup
e.. Desktop
f.. Favorites
g.. Fonts
h.. MyDocuments
i.. NetHood
j.. PrintHood
k.. Programs
l.. Recent
m.. SendTo
n.. StartMenu
o.. Startup
p.. Templates

--
Met vriendelijke groeten.
Jan
"ben" <ben@mc.com> schreef in bericht
news:OTd22UtzDHA.3116@TK2MSFTNGP11.phx.gbl...
> Jan,
>
> thanks for that. that works now... i am trying to get the special
folders.
> the AllUsersProgram doesn't work.
>
> any ideas on what i am doing wrong..
>
> ben
> "JR" <XXX.X@pandora.XXXX> wrote in message
> news:ptdIb.104667$uS1.4662339@phobos.telenet-ops.be...
> > this must be it
> >
> > in VB User = Environ("UserName")
> >
> > in VBS
> > set nw = createobject("wscript.network")
> > User = nw.username
> >
> > folders can you find here
> > set wshshell = wscript.createobject("wscript.shell")
> > wshshell.specialfolders("AllUsersProgram")
> > wshshell.specialfolders("AllUsersstartMenu")
> > wshshell.specialfolders("AllUsersStartup")
> > wshshell.specialfolders("Desktop")
> >
> >
> > --
> > Met vriendelijke groeten.
> > Jan
> > "ben" <ben@mc.com> schreef in bericht
> > news:u$i6gLszDHA.2440@TK2MSFTNGP12.phx.gbl...
> > > hi,
> > >
> > > could anyone tell me how to read the USERNAME variable from a local
> > machine.
> > >
> > > I want to read the currently logged on username, and from there use
that
> > > name in the script.
> > >
> > > ben
> > >
> > >
> >
> >
>
>



Re: environment variables by Torgeir

Torgeir
Sat Jan 03 14:18:11 CST 2004

ben wrote:

> thanks for that. that works now... i am trying to get the special folders.
> the AllUsersProgram doesn't work.

Hi

It is AllUsersPrograms (note the teminating s)...


WSH 5.6 documentation (local help file) can be downloaded from here if you
haven't got it already:
http://msdn.microsoft.com/downloads/list/webdev.asp


--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter