Method for Usage of For and Shift in DoS Command

xiaoxiao2021-03-14  197

------------------------------------------ Save as doscmd.bat - --------------------------------

@echo off

@echo *******

Echo *** Travers the current folder all extension-named .txt documents, sequentially as parameters in "Current Path Each TXT File Name", Call Bat2.bat ***

For %% I in ("% ~ dp0 * .txt") Do Call "% ~ dp0 / bat" %% I && echo ^^^^^^^^^^^ %% i

Echo ****************************************************************** *****

Echo ============= Send 3 params ================================= =========================== @ echo ***********

Echo press any key to continue ... PAUSE> NUL

--------------------------------------- DOSCMD.BAT -------- -----------------------------------------

-------------------------------------------------- ---- Save as ba2.bat ---------------------------

@echo offecho ========== Bat2 display starts ========= SHIFT loop processing all parameters ===== set arg =% 1echo% Arg% Shift: loopif "% 1" == "" Goto endset arg =% arg%% 1echo% arg% shiftgoto loop: endecho =========== bat2 display ends ========== ==== === r% ~ dp0 / Hacker.bat

------------------------------------- Save as ba2.bat -------- -----------------

--------------------- Save as doscmd2.bat ------------------------ ------------

@echo off

@echo **********

@echo ########% ~ i parameter usage ########

Set LCLH =% ~ DP0ECHO% LCLH% for %% I in (% lclh% *. txt) do call% LCLH% BAT2.BAT %% I && echo @@@@ /% i === %% ~ DPI === %% ~ xi === %% ~ ni === %% ~ nxi === %% ~ zi === %% ~ ai === %% ~ ftzai @ echo ###### ##% ~ i parameter usage ########

Echo ####### Number sequence ####################################################################################################################################################################################################################### ##############################

@echo **********

Echo press any key to continue ... PAUSE> NUL

--------------------- Save as doscmd2.bat ------------------------ ------------

转载请注明原文地址:https://www.9cbs.com/read-129415.html

New Post(0)