![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | test for file existence Hi, What is the best way to test for file or directory existence? ls file.txt | out-null 2>&1 if ($? -eq "True"){ .... } |
My System Specs![]() |
| | #2 (permalink) |
| | Re: test for file existence "Frank" <Frank@discussions.microsoft.com> wrote in message news:4F93698C-A4D2-4819-8885-F76E60642776@microsoft.com... > Hi, > > What is the best way to test for file or directory existence? > > ls file.txt | out-null 2>&1 > if ($? -eq "True"){ > ... > } You can use the Test-Path cmdlet for this. test-path file.txt -- Keith |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| .xls file dumped out of existence | Vista file management | |||
| BF2 Point of Existence Mod | Vista Games | |||
| How to test file-filter-driver in Driver Test Manager(DTM)? | Vista General | |||
| How to test file-filter-driver in Driver Test Manager(DTM)? | Vista hardware & devices | |||
| Non-erroring way to test for alias existence? | PowerShell | |||