Quote:How to find and add the file name of each file in a folder to a meta tag - <link rel"canonical" href="https://cure4incurables.in" /> (I am not a software engineer, so please give step by step instructions - I have implemented what is given here: Windows PowerShell Scripting Tutorial For Beginners - Varonis[^] )?
<link rel"canonical" href="https://cure4incurables.in" />
Quote:please give step by step instructions
$metaString = '<link rel"canonical" href="https://cure4incurables.in" />' $files = Get-ChildItem -path C:\Users\rjmac\Documents\VSCode\PowerShell -filter *.txt foreach ($file in $files) { $newString = $metaString + $file.BaseName Write-Output $newString }
$metaString = '<link rel"canonical" href="https://cure4incurables.in/FNAME" />' $files = Get-ChildItem -path C:\Users\rjmac\Documents\VSCode\PowerShell -filter *.txt foreach ($file in $files){ $newString = $metaString -replace "FNAME", $file.BaseName Write-Output $newString }
powershell test.ps1
powershell ./test.ps1
$files = Get-ChildItem -path C:\Users\SKY\Desktop foreach ($file in $files) {Name" $content = Get-Content $file if ($content -match "FNAME") { $content = $content -replace "FNAME", $file.BaseName Set-Content $file $content } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)