Believe me or not! you are going to use this cmdlet in almost all of your scripts.
By using Test-Path cmdlets, we can find if specific file / folder exists or now. If the file/folder does exists then the output is True, and if they don't then the output is False.
The basic usage of the cmdlet is simple, type the Test-Path cmdlet and in -Path parameter provide the name of file/folder which you want to test.
Test-Path -Path C:\temp\ad.txt
In above screenshot, the folder and file both exists, so the output of command in True.
In the above screenshot, neither the folder and file exists, so the output of command is false.
Cool! no :)
With Regards.
Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube” channel
for PowerShell video tutorials. You can download all of my scripts from “Microsoft
TechNet Gallery”.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.