Download File With PowerShell

$Dir = "C:\Temp"
$Url = "https://www.google.com/"

$Now = Get-Date -Format yyyyMMddHHmmss
$File1 = "google-$Now-1.html"

If (!(Test-Path -Path $Dir)) {
    New-Item -ItemType Directory -Path $Dir
}

Invoke-WebRequest -Uri $Url -OutFile "$Dir\$File1" -Verbose

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s