School of Computing. Dublin City University.
Online coding site: Ancient Brain
coders JavaScript worlds
notepad prog.bat
@echo off rem the above line prevents the script echoing back the commands rem is a comment dir |
dir | find "string" | sortExample:
Go into henryiv_1 find "Scot" act*.html find "Scot" act*.html | find "Scots" find "Scot" act*.html | find /v "Scots"
dir > file
set myvar=string echo myvar is %myvar% echo path is %path% copy %1 %homepath%\backup
if '%1'=='' echo no arg if '%1'=='' ( echo no arg ) else ( echo arg )
for %%i in (*.html) do call secondprog %%i
for %%i in (*.*) do ( echo %%i dir %%i )
IF EXIST "C:\Program Files\Mozilla Firefox" ( echo Firefox exists ) ELSE ( echo Firefox missing )Cannot change this layout around too much.
@echo off for /d %%d in ("r*") do find "Ireland" %%d\*htmlThis is the equivalent of:
grep Ireland r*/*html
The BAT scripting language is generally simpler than UNIX/Linux Shell, and the standard utilities are fewer, and have less options, than on UNIX/Linux.
But there are more powerful Windows command-lines.