How to use parameters in batch files
Hacker security net http://www.hacker81.net
Parameters can be used in batches, generally from
1%
Until
9%
These nine, need to use when there are multiple parameters
Shift
To move, this situation is not very common, we don't consider it.
Sample1
:
FOMAT.BAT@echo offif "% 1" == "a" format A:: format @ format A: @echo please insert another disk to driver a, then press any key. @ Pause @ goto fomat
This example is used to continuously format a few floppism, so it is necessary to use it.
DOS
Window input
FOMAT.BAT A
, Huh, it seems to have a little painting snake to add ~
^ _ ^ Sample2
:
When we have to build a
IPC $
At the connection point, you will always enter a big string command. If you can't get it, we will be wrong, so we better write some fixed commands to a batch, put the broiler
IP Username Password
When the parameters are given to this batch, this is not to play a command every time.
@echo off @ Net USE / / 1% / IPC $ "2%" / u: "3%"
Pay attention, here
Password
Is the second parameter.
@if Errorlevel 1 Echo Connection Faled
How is the use parameter is still relatively simple?