Get the App
SLTechnology News&Howtos  ›  Development  › 

How to implement BAT batch processing to determine that the directory is in% Path%

Shulou Source: shulou.com Published: 2022-06-03 09:25:49 11月15日 Update

This article introduces the "how to achieve BAT batch judgment directory in% Path%" related knowledge, in the actual case operation process, many people will encounter such a dilemma, then 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!

It seems that there is no very beautiful way to do this, but to divide the% Path% by a semicolon and compare it paragraph by paragraph.

: InPath [In] Path [Out] 0/1SETLOCALSET LocalPathCopy=%PATH%SET Result=0:WHILEIF "% LocalPathCopy" = = "" GOTO WENDFOR / F "delims=;"% I IN ("% LocalPathCopy%") DO (IF / I "% ~ I" = = "% ~ 1" (SET Result=1 GOTO WEND)) FOR / F "delims=; tokens=1,*"% I IN ("% LocalPathCopy%") DO (SET LocalPathCopy=%%~J) GOTO WHILE: WEND: InPathRetENDLOCAL & SET% 2% result% & GOTO:

How to use it:

SET XeroC:\ WindowsCall: InPath% x% ResultIF% Result% = = 0 SET Path=%Path%;%x% "how to implement BAT batch processing to determine that the directory is in% Path%" is introduced here, 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!

Tags: Catalogue content more knowledge beautiful practical successful next usage practice semicolon dilemma reality situation article method case editing website industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno vpn Docker Microsoft MySQL