a guest May 19th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $USER = read-host "Please enter your name:"
  2. foreach($line in Get-Content C:\Users\User\Desktop\phonebook.txt) {
  3. if($line.Split("{,}")[0] -eq $USER){
  4. $line.Split("{,}")[0];
  5. "--"
  6. $line.Split("{,}")[1];
  7. }else{
  8. $ln=$USER;
  9. $ln=$ln+",";
  10. $p= read-host "Please enter your phone:";
  11. $ln=$ln+$p
  12. Out-File -filepath C:\Users\User\Desktop\phonebook.txt -append -confirm;
  13. }
  14. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand