// batch for loop
for /l %%x in (1, 1, 100) do (
echo %%x
copy %%x.txt z:whateveretc
)
for %%variable in (strings/numbers) do(
your code
)
for /f ["options"] %%variable in (filename) do (
your code
)
for /l ["options"] %%variable in (start_value, increment_by ,end_value) do (
your code
)
Here ["options"]:
delims=xxx The delimiter character(s). Default value = a space
eol=; Default value is ; .If the line starts with ;
it will be treated as comment and it will
not be printed in the output.
You can change the Default value to any other character.
tokens=n Specifies which numbered items to read from each line.
Default value is 1.
for /l %x in (1, 1, 100) do (
echo %x
copy %x.txt z:whateveretc
)
@echo off
:main
:: Put all your code here under the "main" sub-routine
echo EXECUTED MAIN
goto rerun_prompt
:rerun_prompt
ECHO Re-run the script? [Y/N]:
SET /p choice=
IF /I %choice% == Y goto main
IF /I %choice% == N (
echo Exiting...
EXIT
)
ECHO "%choice%" is not valid, try again
goto rerun_prompt
for /l %%x in (1, 1, 100) do (
echo %%x
)
Code Example |
---|
Shell :: git merge message |
Shell :: php enable extension lphp.ini |
Shell :: sed replace number |
Shell :: install cherrypy |
Shell :: Related to anydesk not opening in ubuntu |
Shell :: how to mount windows folder on ubuntu |
Shell :: conda install pandas |
Shell :: bash printf format |
Shell :: install neovim mac |
Shell :: how to install wireshark on fedora |
Shell :: extend recording time in ubuntu |
Shell :: change time linux |
Shell :: bedrock linux |
Shell :: can not ping github |
Shell :: amend specific commit |
Shell :: git push and pull not asking password |
Shell :: bash sed with variable |
Shell :: grep without match |
Shell :: intellij for mac crack |
Shell :: powershell get OS |
Shell :: cp command exclude files |
Shell :: rpm extract |
Shell :: copy file in linux command |
Shell :: how to remove blank lines in bash |
Shell :: ruby install for mac |
Shell :: docker image tar import |
Shell :: skip husky |
Shell :: Not an editor command: LspInstall |
Shell :: redis download |
Shell :: reset resolv.conf |