Does Powershell have a cache that needs to be cleared?

前端 未结 1 1252
小蘑菇
小蘑菇 2021-02-13 03:29

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         


        
相关标签:
1条回答
  • 2021-02-13 03:44

    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.

    0 讨论(0)
提交回复
热议问题