@echo off :: Parses the output of the "net config" command to get :: the user name. Uses debug to trim :: away all unwanted info from the response line. set value= :: Use net config to get lots of data, then filter it net config | find "User name" > setvalue.bat :: Use DEBUG to overwrite the beginning data > script echo e 0100 " set value=" >> script echo w >> script echo q debug setvalue.bat < script > nul del script call setvalue.bat del setvalue.bat echo User name is %value% :: Miles Fenton in the UK pointed out that while :: "net config" works under Win9x, you'll need to :: use "net config server" or :: "net config workstation" when running under NT.