copy-item where file name is the computer hostname

前端 未结 3 1839
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-14 17:32

Having what seems to be a basic problem in Powershell. I am doing a simple copy-item script from a UNC share to the local C:\\ drive. Here is my code:



        
3条回答
  •  悲哀的现实
    2021-01-14 18:02

    You could also directly embed the environment variable in double quoted string:

    Copy-Item "\\server\share\$env:computername.txt" C:\
    

提交回复
热议问题