JSI Tip 0273 - Little known DOS trick assists logon script.

When you write a logon script, the batch file can not determine where it is running from and different clients point the current directory to various places. A little known DOS trick can prevent you from having to hard code the directory and have different scripts for different servers.

Use %0\..\<filename> syntax in your logon script. A simple example can been seen at tip 120 where the following code is used to invoke Kix32:

@echo off
%0\..\KIX32 LOGON
Exit

This works with all client systems an tells the client that the KIX32 program is located in the NetLogon share.

See tip 523.

NOTE: When the %0 variable is expanded in Windows XP, the result is enclosed in quotation marks.



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish