In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the knowledge of "introduction to the use of DOS comparison operator". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Rem comparison operator:
EQU-equals
NEQ-not equal to
LSS-less than
LEQ-less than or equal to
GTR-greater than
GEQ-greater than or equal to
For example
If not in%==2 goto 2
Such as:
If in% NEQ 1 goto 2
Note that text comparison should use =
&: the previous command was executed successfully before the following command was executed.
| |: the previous command failed to execute before the following command was executed
&: execute the following command regardless of whether the previous command is successful or not
| |: pipe operator. The output of the previous command is used as the input of the following command. |
Demonstrate the deletion of files modified 7 days ago (including 7 days ago)
:: DateDel.bat-demonstrate deletion of files modified 7 days ago (including the 7th day): Will Sort-2021-8-26-CMD@WinXP:: Note: do not put this batch file in the directory where you need to choose to delete files:: the program only performs the deletion demonstration. If the demonstration is correct, deleting the echo in front of the del can be executed normally: if the date of the first execution is not 2021-8-26 You need to adjust the list of retention dates in the fourth line of code: the program needs to be run at least once a day To automatically update the date list @ echo offif "% 1" = ":" goto% 2if exist% temp%.\ _ DateDel.bat% temp%.\ _ DateDel.bat%0: Update 2021-08-20 2021-08-21 2021-08-22 2021-08-23 2021-08-24 2021-08-25 2021-08-26:Updatesetlocal EnableExtensionsset today=%date:~0,10%if not "% today%" = "% 9"% 0: Update% 4% 5% 6% 7% 8% 9 % today%echo% 0: Update% 3% 4% 5% 6% 7% 8% 9 >% temp%.\ _ DateDel.bat:Deletefor / r% f in (*. *) do if "% ~ tf" LEQ "% 3" echo del "% f": End
Batch numerical calculation and size comparison
Variable
Set variable
Set month=7
Use variables
% day%
Annotation
:: please run as administrator
Compare the size
EQU equals
NEQ is not equal to
LSS is less than
LEQ is less than or equal to
GTR is greater than
GEQ is greater than or equal to
If statement
If the date is greater than 31, the date is set to 1 and the month plus 1.
If% day% GTR 31 (set / a day=1 set / a month=month+1)
While cycle
Using the Goto statement to implement
: while
/ / Loop content
Pause
Goto: while
Output to screen
Echo date% form data has been copied to the clipboard
Output to text
Echo f > res.txt
Read text to clipboard
Clip < res.txt
Delete a file
Del res.txt
suspend
Pause
Turn off echo
@ echo off
This is the end of the introduction to the usage of DOS comparison operator. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.