Use of the %0\..\ Syntax in SMSLS.BAT

Last reviewed: April 15, 1997
Article ID: Q121387

The information in this article applies to:
  • Microsoft Systems Management Server versions 1.0, 1.1 and 1.2

SUMMARY

When programs are run from a logon script, and they are located in the NETLOGON share, the actual logon script does not know what drive or path from which to execute the program, and the NETLOGON share is not included in the DOS path statement. To resolve this, Systems Management Server utilizes a little known feature of DOS to "determine" the drive and path the script is running from.

MORE INFORMATION

During a logon and when the logon script is running, the LMSCRIPT.EXE program runs its commands from the NETLOGON share. However, batch files have no way of determining where they are running from, and the current directory set by LMSCRIPT.EXE is not the NETLOGON share.

As a workaround, Systems Management Server uses the %0\..\ path to indicate the argv[0] present when the batch file was run. The batch file can then refer to this path and know its own location and look for other files there.

An example of this can be found in the Slow Network detection portion of the SMSLS.BAT logon script file:

   REM SNET_DOS
   %0\..\netspeed
   if not errorlevel 1 goto NET_DOS
   if not errorlevel 2 goto END
   if errorlevel 2 %0\..\choice /T:Y,30 Slow network detected. Continue
   if not errorlevel 2 goto NET_DOS
   goto END

Prior to use of this technique, Systems Management Server was forced to use a hard coded drive letter of Z: to reference needed files. Now the drive used during a NET LOGON can be arbitrary, and dynamically determined.


Additional query words: sms prodsms login
Keywords : kbnetwork smsconfig smshowto
Version : 1.0 1.1 1.2
Platform : 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: April 15, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.