Sometips two cool bat scripts

Source: Internet
Author: User
A reboot BAT file should be applicable in all Windows systems

Date: 2002-1-13 18:34:39

@ Echo off
Echo welcome to
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

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


[Adam @ isbase Adam] $ which 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


: 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 input file description, returns the full path of the file!


Let's test our program:

Microsoft Windows 2000 [version 5.00.2195]

(C) Copyright 1985-1998 Microsoft Corp.

C:/> which


Enter the file name and return the full path of the file!

C:/> which cmd.exe



OK. The test is successful!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.