![]() |
How to Group Multiple Commands in cmd.exe
How to Group Multiple Commands in cmd.exe www.wisdombay.com This article is an attempt at explaining the task of getting multiple commands executed in a sequential way in cmd.exe. This article also looks at executing groups of commands based on the status of (success or failure) of any previous commands. First of all let's have a look at Chaining Multiple commands. Syntax : command1 & command2 For example if you need to change the current directory to a specific directory and then list all the .mp3 files there, you can go for the below given command کد HTML:
C:\ cd mymusic & dir *.mp3 Conditional execution of chained commands The below given syntaxes can help you in situations were you need to execute some chained command based on the outcome of some previous command. These come handy when you are writing Scripts or Batch files. 1. Syntax : Command1 && Command2 This makes sure that command2 is executed only if command1 is executed successfully. Ex : کد HTML:
dir *.bat && echo "Batch Files Found" 2. Syntax : Command1 || Command2 This makes sure that command2 is executed only if command1 is not executed successfully. So in this case command2 is executed only when command1 fails. Ex : کد HTML:
dir *.bat || copy d:\usefulbats\*.bat . Grouping Command Chains This section explains, how you can combine and exactly control the order in which the command chain is executed. Ex : کد HTML:
hostname & ver & vol > info.txt کد HTML:
(hostname & ver & vol) > info.txt So i am winding up this paper on using Grouped commands in cmd.exe for now. Will catch up with you later with more technical papers like these in the future |
اکنون ساعت 12:14 PM برپایه ساعت جهانی (GMT - گرینویچ) +3.5 می باشد. |
Powered by vBulletin® Version 3.8.4 Copyright , Jelsoft Enterprices مدیریت توسط کورش نعلینی
استفاده از مطالب پی سی سیتی بدون ذکر منبع هم پیگرد قانونی ندارد!! (این دیگه به انصاف خودتونه !!)
(اگر مطلبی از شما در سایت ما بدون ذکر نامتان استفاده شده مارا خبر کنید تا آنرا اصلاح کنیم)