How to use parameters in batch files


@echo off
if “%1″==”a” format a:
@format a:
@echo please insert another disk to driver A,then press any key.
@goto fomat
This example is used to format several floppy disks consecutively, so you need to input them in DOS window fomat.bat a. Hehe, it seems that it’s a bit superfluous^_^
When we want to establish an IPC $connection, we always need to input a series of commands. If we don’t get it right, we will make a wrong number. So we might as well write some fixed commands to a batch, and assign the IP user name password to the batch as a parameter, so that we don’t have to type commands every time.
@echo off
@Net use \ \ 1% \ IPC $”2%” / u: “3%” note that password is the second parameter.
@if errorlevel 1 echo connection failed
How to use parameters is relatively simple, right?