Loading ...
Sorry, an error occurred while loading the content.

Re: [BATCH WORLD] Username Env. Variable?

Expand Messages
  • Jim Knopf
    ... @echo off if .%1==. goto:Get if NOT .%1==./? goto:Set echo Sets USERNAME variable to the username. echo. echo [CALL] USERNAME for %%a in (echo.
    Message 1 of 2 , Jan 2, 2001
    • 0 Attachment
      > I have some 95 and 98 clients that don't seem to have the %username%
      > environment variable set even though they're logged onto the
      > network. Anyway to set this or something I can add to startup to set
      > this? Thanks again all!


      :: --------------------------------------------------------------------
      :: Batchfile : username.bat (Filename important!)
      :: Purpose : Sets USERNAME variable to the username.
      :: OS : MS-DOS 7.x AKA Windows 9x (Tested: Windows 98)
      :: Created : Frank-Peter Schultze , 2000-11-15
      :: --------------------------------------------------------------------
      @echo off
      if .%1==. goto:Get
      if NOT .%1==./? goto:Set
      echo Sets USERNAME variable to the username.
      echo.
      echo [CALL] USERNAME
      for %%a in (echo. goto:End) do %%a
      :Get - the username from the registry -------------------------------
      set | FIND "winbootdir=" > NUL
      if errorlevel 1 for %%a in (echo goto:End) do %%a Win9x Batchfile.
      START /w REGEDIT /e %temp%.\~tmp.bxt HKEY_LOCAL_MACHINE\Network\Logon
      type %temp%.\~tmp.bxt | FIND /i "username" > %temp%.\~tmp.bat
      %temp%.\~tmp.bat (calls %0 w/username)
      :Set - the username variable w/o "" ---------------------------------
      for %%a in (%1) do set USERNAME=%%a
      del %temp%.\~tmp.b?t
      :End ----------------------------------------------------------------


      HTH


      __ _ _
      |_ |_)(__ http://www.fpschultze.de
      ___| | ____)chultze_________________________________________________
      I am logged in, therefore I am.
    • Jason Bias
      Excellent! I got as far as getting the username = jb into a txt file. Couldn t figure out what to do from there. This should save me a ton of work.
      Message 2 of 2 , Jan 2, 2001
      • 0 Attachment
        Excellent! I got as far as getting the "username" = "jb" into a txt file.
        Couldn't figure out what to do from there. This should save me a ton of
        work. Thanks a bunch!

        JB

        -----Original Message-----
        From: Jim Knopf [mailto:jknopf@...]
        Sent: Tuesday, January 02, 2001 4:29 PM
        To: batchworld@egroups.com
        Subject: Re: [BATCH WORLD] Username Env. Variable?


        > I have some 95 and 98 clients that don't seem to have the %username%
        > environment variable set even though they're logged onto the
        > network. Anyway to set this or something I can add to startup to set
        > this? Thanks again all!


        :: --------------------------------------------------------------------
        :: Batchfile : username.bat (Filename important!)
        :: Purpose : Sets USERNAME variable to the username.
        :: OS : MS-DOS 7.x AKA Windows 9x (Tested: Windows 98)
        :: Created : Frank-Peter Schultze , 2000-11-15
        :: --------------------------------------------------------------------
        @echo off
        if .%1==. goto:Get
        if NOT .%1==./? goto:Set
        echo Sets USERNAME variable to the username.
        echo.
        echo [CALL] USERNAME
        for %%a in (echo. goto:End) do %%a
        :Get - the username from the registry -------------------------------
        set | FIND "winbootdir=" > NUL
        if errorlevel 1 for %%a in (echo goto:End) do %%a Win9x Batchfile.
        START /w REGEDIT /e %temp%.\~tmp.bxt HKEY_LOCAL_MACHINE\Network\Logon
        type %temp%.\~tmp.bxt | FIND /i "username" > %temp%.\~tmp.bat
        %temp%.\~tmp.bat (calls %0 w/username)
        :Set - the username variable w/o "" ---------------------------------
        for %%a in (%1) do set USERNAME=%%a
        del %temp%.\~tmp.b?t
        :End ----------------------------------------------------------------


        HTH


        __ _ _
        |_ |_)(__ http://www.fpschultze.de
        ___| | ____)chultze_________________________________________________
        I am logged in, therefore I am.



        To Post a message, send it to: batchworld@...

        To Unsubscribe, send a blank message to: batchworld-unsubscribe@...
      Your message has been successfully submitted and would be delivered to recipients shortly.