Using SYS(0) Function to Get User Name from Network

ID: Q96346

2.5x 2.6x 3.00 | 2.00 2.5x 2.6x

WINDOWS        | MS-DOS
kbprg

The information in this article applies to:

  - Microsoft FoxPro for Windows, versions 2.5x, 2.6x
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6x

    SUMMARY

    The SYS(0) function is used to return a character string of the machine number and machine name when you are using FoxPro/LAN version 2.0 for MS-DOS or FoxPro version 2.5. NOTE: In order for this function to work, a machine number and name must first be assigned by the network software.

    MORE INFORMATION

    By setting an MS-DOS environment variable called USER, a machine name can be returned on most networks. For example, place the following line in the AUTOEXEC.BAT file:

       SET USER=JOHNDOE
    
    
    SYS(0) will then return the name JOHNDOE.

    On a Novell network, place the following line in the login script:

       MACHINE="%LOGIN_NAME"
    
    
    SYS(0) will return the user's Novell login name. In this example, it is important that LOGIN_NAME be placed in all caps.

    To return both the user's login name and the station number on a Novell network, add the following line to the login script:

       MACHINE="%LOGIN_NAME %STATION"
    
    
    Additional reference words: VFoxWin 3.00 FoxDos FoxWin 2.00 2.50 2.50a 2.50b 2.60 2.60a User Login Novell novel KBCategory: kbprg KBSubcategory: FxnetworkNetware
    Keywords          : FxnetworkNetware 
    Version           : 2.5x 2.6x 3.00 | 2.00 2.5x 2.6x
    Platform          : MS-DOS WINDOWS

    Last Reviewed: January 9, 1998