This morning, I copied a directory from my local, networked drive to temp folder for testing. This error appeared.
Get-Content : Cannot find path \'C:\\users\\x
Variables are stored in the session, so if you close your powershell console and open a new one, all custom variables will be gone. If you want to see what variables exists, use Get-Variable
. To delete a specific variable(to make sure it's gone), you could use:
Remove-Variable varname
.
As for you question. A variable in the global(session) scope is stored in the session until it's removed or overwritten. If you used the same powershell console to run that code twice, then $inpath
should have been set to "C:\temp\tx"
the second time, and $srcfiles
would be updated with the new filelist.