Skip to content

Instantly share code, notes, and snippets.

@jtuttas
Created February 25, 2013 08:40
Show Gist options
  • Save jtuttas/5028533 to your computer and use it in GitHub Desktop.
Save jtuttas/5028533 to your computer and use it in GitHub Desktop.
aktuelles Datum in eine HTML-Datei schreiben
<!DOCTYPE html>
<html>
<head>
<title>Datum</title>
</head>
<body>
<h1>Heute ist der:</h1>
</body>
</html>
cls
$d=Get-Content ("datum.html")
$i=1
$t=Get-Date
foreach ($line in $d) {
if ($line -match "<h1>Heute ist der:") {
$line="<h1>Heute ist der: $t</h1>"
}
if ($i-eq 1) {
$line | Set-Content("datum.html")
}
else {
$line | Add-Content("datum.html")
}
Write-Host ("$i $line")
$i++
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment