A reboot BAT file should be applicable in all Windows systems
Author: joyadam@myrealbox.com
Date: 2002-1-13 18:34:39
@ Echo off
Echo welcome to http://www.sometips.com
Setlocal
CD/d % Temp %
Echo [version]> Reboot. inf
Set INF = installhinfsection defaultinstall
Echo Signature = $ Chicago $> Reboot. inf
Echo [defainstall install]> Reboot. inf
Rundll32 setupapi, % INF % 1% TEMP %/reboot. inf
Del reboot. inf
Author: joyadam@myrealbox.com
Date: 2002-1-13 18:34:21
In Linux, there is a command called which, which can find and display the directory where a command is located in path.
In Linux:
[Adam @ isbase Adam] $ which ls
/Bin/ls
[Adam @ isbase Adam] $ which RM
/Bin/RM
In NT resource kitthere is a where.exe, which has the same effect, but a set of resource kit costs $300. Here we can make a batch file to implement this function.
Use NotePad to edit a which. BAT file and store it in the WINNT directory or another path variable. The content of the batch file is as follows:
@ Echo off
Rem check command line parameters
If {% 1 }={} Goto: Usage
For % I in ({{/ {-) do if {% 1 }=%% I ?} Goto: usage % I
Echo.
: REM checks the current directory to check whether the file exists.
For % I in (% 1) do if exist % ~ NX % I (
Echo % ~ Fi
Goto: EOF
)
: REM checks the file in Path
For % I in (% 1) Do (
If exist % ~ $ Path: I (
Echo % ~ $ Path: I
) Else (
Echo error: % 1 is not in the path !!!
Goto: Usage
)
)
Goto: EOF
: Usage
Echo.
ECHO which "FILENAME"
Echo.
Echo input file description, returns the full path of the file!
Echo.
Let's test our program:
Microsoft Windows 2000 [version 5.00.2195]
(C) Copyright 1985-1998 Microsoft Corp.
C:/> which
Which "FILENAME"
Enter the file name and return the full path of the file!
C:/> which cmd.exe
C:/winnt/system32/cmd.exe
C:/>
OK. The test is successful!