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

Last reviewed: January 8, 1998
Article 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 kbprg
    Version : 2.5x 2.6x 3.00 | 2.00 2.5x 2.6x
    Platform : MS-DOS WINDOWS


    THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

    Last reviewed: January 8, 1998
    © 1998 Microsoft Corporation. All rights reserved. Terms of Use.