Author Posts

June 6, 2017 at 3:22 pm

When I type below command the new value is appended to the existing value;
(Get-Content C:\temp\File.ini) -replace 'IP_1=*', ('IP_1='+$ip) | Set-Content c:\temp\File.Ini

And when I add a period to the old character value 'IP_1=.*' the old value is replaced totally, wanted to know how does period work here?


June 6, 2017 at 3:28 pm

Is it trying to dot source the file? I can't be sure, but that's perhaps what its doing, look at

Its also used for objects, so maybe it's doing something funky? Sorry i couldn't be more help.

June 6, 2017 at 5:24 pm

-replace works with regular expressions. A period is the meta charachter for "any charachter" and the star/asterisk (*) is the modifier meaning 0 or any number of occurances of the charachter or meta charachter or group right before this meta charachter.

What is it, what you're trying to accomplish?

June 7, 2017 at 7:10 am

Thank you Olaf and Chris.
I am using the command to modify an IP address in the ini file IP_1 = x.x.x.x to IP_1 = y.y.y.y


June 7, 2017 at 8:21 am

If you're looking for literal periods with regex you have to "escape" them with a backslash ... like this "\."