Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Getting date and comparing

$
0
0

I want to compare the present date with the one in a file

$fecha1=Get-Date -format "dd/MM/yyyy"
$fecha2=((Get-Item C:\HOSTSUPDATE\HOSTS).LastWriteTime).Tostring().substring(0,10)

if $fecha1 -eq $fecha2) {

}

Is there a better way of doing things?


Viewing all articles
Browse latest Browse all 6937

Trending Articles