How to use parameters in batch files
This article mainly shows you "how to use parameters in batch files". The content is simple and easy to understand. It is clearly organized. I hope it can help you solve your doubts. Let Xiaobian lead you to study and learn "how to use parameters in batch files".
sample1:
fomat.bat
@echo off
if "%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 format several floppy disks in succession, so when using it, you need to enter fomat.bat a in the dos window. Hehe, it seems a bit superfluous ~^_^
sample2:
When we want to establish an IPC$connection, we always have to enter a series of commands, so we might as well write some fixed commands into a batch, and assign the broiler IP USERNAME PASSWORD as a parameter to this batch, 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
That's all for "How to use parameters in batch files." Thanks for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!