Hello
the following lines results to a text file on my desktop which it contains following two lines (my ipv4 address & ipv6 address):
10.1.1.1
fe80::d4c4:49d4:5a94:b92a
now i need a code to clear the 2nd line (ipv6 address), but i got the following error:
" the process cannot access the file....."
but the file is not in used & every window & App is closed. i tried it many times even logoff & login again .
i studies both get-content & set-content help files & i searched this in Google but no related result:
"get-content piped to clear-content error can't access the file..."
any idea?
new-item -name 'MyipAddress.txt' -Path "$home\desktop" -ItemType file -Force $file = "$home\desktop\MyipAddress.txt" $nic = gwmi -class win32_networkadapterconfiguration | where index -eq 14 $nic.IPAddress | Add-Content -Path $file Get-Content $file -Tail 1 | Clear-Content -Force
- Edited by john.s2011 16 hours 55 minutes ago