GEORGE TRIFONOV Home Developer Corner Contact Resume 
Theme
Login
 
 
Powershell If statement example

Powershell if statement syntax:

   1: If (condition) {statement}

Example 1 - Checking file or directory existence and copying file if it is exists

   1: $iis ="C:\logs\test.log"
   2: $file = "\\netshare\destination.log"
   3: if(Test-Path $iis){ Copy-Item $iis $file -force}
Share this post: email it! | bookmark it! | digg it! | kick it! | live it!
Posted: Mon, 16 Jun 2008 15:59:18 GMT By: Gtrifonov