I am would like to read in the text after the last backslash from my text file. Currently I have:
$data=Get-Content \"C:\\temp\\users.txt\"
You can use Split and [-1] to get the string after the last backslash:
$data = Get-Content "C:\temp\users.txt" $file = ($data -split '\\')[-1]
This uses two backslashes as backslash is a regex special character (escape) so the first slash is escaping the second.