cmd for в for



Автор Без_названия задал вопрос в разделе Другие языки и технологии

разъясните не понимаю, что такое параметры в операторе FOR cmd интересует delims tokens eol по справке непонятно и получил лучший ответ

Ответ от Григорий Санду[гуру]
Если по справке не понятно, то это уже клиника .
ссылка
Conditionally perform a command several times.
syntax-FOR-Files
FOR %%parameter IN (set) DO command
syntax-FOR-Files-Rooted at Path
FOR /R [[drive:]path] %%parameter IN (set) DO command
syntax-FOR-Folders
FOR /D %%parameter IN (folder_set) DO command
syntax-FOR-List of numbers
FOR /L %%parameter IN (start,step,end) DO command
syntax-FOR-File contents
FOR /F ["options"] %%parameter IN (filenameset) DO command
FOR /F ["options"] %%parameter IN ("Text string to process") DO command
syntax-FOR-Command Results
FOR /F ["options"] %%parameter IN ('command to process') DO command
The operation of the FOR command can be summarised as...
Take a set of data
Make a FOR Parameter %%G equal to some part of that data
Perform a command (optionally using the parameter as part of the command).
Repeat for each item of data
If you are using the FOR command at the command line rather than in a batch program, use just one percent sign: %G instead of %%G.
FOR Parameters
The first parameter has to be defined using a single character, for example the letter G.
FOR %%G IN ...
In each iteration of a FOR loop, the IN ( ...) clause is evaluated and %%G set to a different value
If this clause results in a single value then %%G is set equal to that value and the command is performed.
If the clause results in a multiple values then extra parameters are implicitly defined to hold each. These are automatically assigned in alphabetical order %%H %%I %%J ...(implicit parameter definition)
If the parameter refers to a file, then enhanced variable reference may be used to extract the filename/path/date/size.
You can of course pick any letter of the alphabet other than %%G.
%%G is a good choice because it does not conflict with any of the pathname format letters (a, d, f, n, p, s, t, x) and provides the longest run of non-conflicting letters for use as implicit parameters.
G > H > I > J > K > L > M
Format letters are case sensitive in Windows 2000 and above, so using a capital letter is also a good way to avoid conflicts %%A rather than %%a.
Examples
FOR /F "tokens=1-5" %%G IN ("This is a long sentence") DO @echo %%G %%H %%J
will result in the output: This is long
Create a set of 26 folders, one for each letter of the alphabet:
FOR %%G IN (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) DO (md C:demo\%%G)
Running multiple commands in a FOR loop
Within a FOR loop, variables are expanded at the start of the loop and don’t update until the entire DO section has completed.
The following example counts the files in the current folder, but %count% always returns 1:
@echo off
SET count=1
FOR /f "tokens=*" %%G IN ('dir /b') DO (
echo %count%:%%G
set /a count+=1 )
To update variables within each iteration of the loop we must either use EnableDelayedExpansion or else use the CALL :subroutine mechanism as shown below:
@echo off
SET count=1
FOR /f "tokens=*" %%G IN ('dir /b') DO (call :subroutine"%%G")
GOTO :eof
:subroutine
echo %count%:%1
set /a count+=1
GOTO :eof
Источник: ссылка

Ответ от 3 ответа[гуру]
Привет! Вот подборка тем с ответами на Ваш вопрос: разъясните не понимаю, что такое параметры в операторе FOR cmd интересует delims tokens eol по справке непонятно

Как сделать матрицу в командной строке?
1) Открой программу Блокнот.
Скопируй и вставь вот этот текст:


setlocal
подробнее...
спросили в Far Cry
не могу врубиться, как включить коды в far cry. добавляю в имя ярлыка "-devmode", но ничего не работает! хелп!
файл Far Cry DevMode.cmd по этой инструкции запусти

Far Cry (или другие дополнения) :
подробнее...
спросили в Интернет Веб почта
Не могу зайти ВКонтакт. Веб-страница недоступна. Подключение к vk.com прервано.
Бывает такое...
Попробуйте ЭТО:
gadget-media.ru/the-best-browser-for-windows/
Почти
подробнее...

Как создать файл *.bat или *.cmd????
В любом текстовом редакторе (notepad.exe и edit.com) даже можно в командной строке создать,
подробнее...
Ответ от 3 ответа[гуру]
Привет! Вот еще темы с похожими вопросами:
спросили в Pemex
У меня в процессах сидит процесс что за процесс: ping.exe????
ахах) ) убил ))

Anonymous
Мастер
(1706)
Если вы не запускали эту
подробнее...

Вопрос по циклам for /f в cmd
а так
@echo off
SETLOCAL EnableDelayedExpansion
set inc=0
for /f usebackq %%i in
подробнее...

Дайте коды на Far Cry 1
Fаr Сrу

Запустите игру с помощью командной строки с параметром "-DЕVМОDЕ"
(oткpoютcя
подробнее...

Добавление символа в начало имени файла (cmd.exe)
SETLOCAL ENABLEDELAYEDEXPANSION
for %%i in (*.ini) do set ss=%%~ni && set s1=!ss:~1,-1!&& ren
подробнее...
спросили в Cassiopeia
BAT и CMD узнать версию ОС
echo Win7 или WinXP?
chcp 866
pause

cd %SYSTEMDRIVE%\\Users\\ && cd c:\\win\\7 ||
подробнее...

У кого-нить есть чит-коды к Far Cry - Antiterror (Можно только бессмертие)?
Я не знаю точно будут ли они работать!

Запустите игру с помощью командной строки с
подробнее...

Что делать если при заходе в Warface в миссию вылетаю и выдает ошибку Memory allocation for 1398228 bytes failed *
Данная ошибка возникает при нехватке оперативной памяти. Одним из способов решения проблемы может
подробнее...
 

Ответить на вопрос:

Имя*

E-mail:*

Текст ответа:*
Проверочный код(введите 22):*