Tuesday 14 May 2013

VBSCRIPT - GET LOGIN USERNAME

'Create Shell Object
Set shell = CreateObject("wscript.shell")

'Execute command Prompt(DOS) to get current username

Set oExec = shell.Exec("cmd.exe /c echo %username%")

'Print All output
msgbox oExec.Stdout.ReadAll
 
set oExec =nothing
set shell = nothing



OUTPUT
=======
 Current username will get displayed

No comments:

Post a Comment