Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use parameters in batch files

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report