Sometips two very Cool BAT scripts

xiaoxiao2021-03-06  41

A reboot BAT file should be available in all systems of Windows

Author: joyadam@myrealbox.com Date: 2002-1-13 18:34:39

@echo offecho welcome to http: //www.sometips.comsetlocalcd/d% temp% echo [version]> reboot.infset inf = InstallHinfSection DefaultInstallecho signature = $ chicago $ >> reboot.infecho [defaultinstall] >> reboot.infrundll32 setupapi % INF% 1% TEMP% / Reboot.infdel Reboot.inf

Author: Joyadam@myrealbox.com Date: 2002-1-13 18:34:21

Under Linux, there is a command called Which, which can look for a directory where a command is located and displayed in Path.

LINUX under:

[ADAM @ isbase adam] $ Which LS

/ bin / ls

[ADAM @ isbase adam] $ Which RM

/ bin / rm

There is a WHERE.exe in NT's Resource Kit, but he also has the same effect, but a resource kit is $ 300, here we can make a batch file to implement this feature.

Use Notepad to edit a Which.bat and store it in a directory in the Winnt directory or other PATH variable, the contents of the batch file are 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 if the file is present in the current directory

For %% I in (% 1) do if exist %% ~ NX% i (

Echo %% ~ FI

Goto: EOF

)

: REM Check this 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 Enter the file, return to the full path to the file!

echo.

Let's take a test of our program:

Microsoft Windows 2000 [Version 5.00.2195]

(C) Copyright 1985-1998 Microsoft Corp.

C: /> Which

Which "filename"

Enter the file, return the full path to the file!

C: /> Which cmd.exe

C: /winnt/system32/cmd.exe

C: />

OK, test passed!

转载请注明原文地址:https://www.9cbs.com/read-73912.html

New Post(0)