Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am having a powershell code to replace the value of the files in the specified path. i am not understanding how to convert the powershell script to batch script.
Please help me. In our environment we don't have access to powershell and i am new to scripting.

$files = Get-ChildItem -path C:\DATA\Files -filter *.txt
foreach ($file in $files)
{
    $content = Get-Content $file
    if ($content -match "99999999")
    {
        $content = $content -replace "99999999", $file.BaseName
        Set-Content $file $content
    }
}


What I have tried:

I am new to scripting please help me
Posted
Updated 30-Aug-18 9:15am

1 solution

Not easily. You're trying to build an F1 car using only the parts from a Model T.

DOStips - FindAndReplace example[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900