Regex Characters and who must be escaped

The following should be escaped if you are trying to match that character

\ ^ . $ | ( ) [ ]
* + ? { } ,

Special Character Definitions
\ Quote the next metacharacter
^ Match the beginning of the line
. Match any character (except newline)
$ Match the end of the line (or before newline at the end)
| Alternation
() Grouping
[] Character class
* Match 0 or more times
+ Match 1 or more times
? Match 1 or 0 times
{n} Match exactly n times
{n,} Match at least n times
{n,m} Match at least n but not more than m times
More Special Character Stuff
\t tab (HT, TAB)
\n newline (LF, NL)
\r return (CR)
\f form feed (FF)
\a alarm (bell) (BEL)
\e escape (think troff) (ESC)
\033 octal char (think of a PDP-11)
\x1B hex char
\c[ control char
\l lowercase next char (think vi)
\u uppercase next char (think vi)
\L lowercase till \E (think vi)
\U uppercase till \E (think vi)
\E end case modification (think vi)
\Q quote (disable) pattern metacharacters till \E
Even More Special Characters
\w Match a „word“ character (alphanumeric plus „_“)
\W Match a non-word character
\s Match a whitespace character
\S Match a non-whitespace character
\d Match a digit character
\D Match a non-digit character
\b Match a word boundary
\B Match a non-(word boundary)
\A Match only at beginning of string
\Z Match only at end of string, or before newline at the end
\z Match only at end of string
\G Match only where previous m//g left off (works only with /g)

Windows shell: rename all files to lowercase

Alle Files in einem Verzeichnis klein zu schreiben ist sogar recht einfach, da wir alles über die „dir“-Ausgabe pippen können.

for /f "Tokens=*" %f in ('dir /l/b/a-d') do (rename "%f" "%f")

Was bedeutet was?

for /f – Für jede einzelne Zeile
„Tokens=*“ – Zwinge jede Ausgabe in eine einzelne Zeile
%f in (…) – %f das ist der Variablenname, in dem Fall der Filename, der von „dir“ übergeben wird.
dir – listet alle Dateien in einem Verzeichnis auf
/l – (Parameter von dir) alles klein schreiben.
/b – (Parameter von dir) nur die Filename zeigen, kein Größen, Datum etc. (sonst würde das mit in den neuen Namen fließen)
/a-d – (Parameter von dir) Keine Verzeichnisse auflisten (a = attribute / – ist die Verneinung und d bedeutet Verzeichnis (Directory)).
rename „%f“ „%f“- Benenne den Namen mit sich selbst um, da wir vorher schon das „dir“ gefiltert haben, erübrigt sich hier ein weiteres Eingreifen.

Windows shell: rename all files to lowercase weiterlesen

Windows Shutdown/Sleeptimer

shutdown /s /f /t 3600

Mit diesem Shutdown-Timer sagt man in der Shell (Eingabeaufforderung) das der Computer in 60 Minuten (/t 3600) erzwungen (/f) heruntergefahren (/s) werden soll.

shutdown /a

Hiermit wird der Shutdown abgebrochen. In einer *.bat kann das ganze übrigens dann auch einfach per Mausklick ausgelöst werden.

Weitere Informationen über den Windows Shutdown