Use of the %0\..\ Syntax in the Smsls.bat File (121387)



The information in this article applies to:

  • Microsoft Systems Management Server 1.0
  • Microsoft Systems Management Server 1.1
  • Microsoft Systems Management Server 1.2

This article was previously published under Q121387

SUMMARY

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

MORE INFORMATION

During a log on 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 determine 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 hard-coded drive Z to reference needed files. Now the drive used during a NET LOGON can be arbitrary, and dynamically determined.

For additional information about the use of %0\..\ with Microsoft Windows XP, click the following article number to view the article in the Microsoft Knowledge Base:

318689 A Logon Script Does Not Work If %0 or %0\..\ Calls Multiple Commands


Modification Type:MajorLast Reviewed:9/11/2003
Keywords:kbConfig kbinfo kbnetwork KB121387