Created
February 25, 2013 08:40
-
-
Save jtuttas/5028533 to your computer and use it in GitHub Desktop.
aktuelles Datum in eine HTML-Datei schreiben
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Datum</title> | |
</head> | |
<body> | |
<h1>Heute ist der:</h1> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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