我具有下面的脚本来移动和替换现有文件。它有效并且已经过测试。
Get-Item -Path "C:\Users\Chris\AppData\Local\test1" | Rename-Item -NewName "test2"
Copy-Item C:\Users\Chris\Desktop\test1 -Destination C:\Users\Chris\AppData\Local -Recurse
现在,我的问题是我想将此应用到远程终端环境,其中有一个FileServer A存放用户当前的本地数据,并且有一个漫游文件夹,我需要从特定终端(例如TS01)上移动数据。 / p>
我要完成以下任务:
Get-Item -Path "FILESERVER\username\AppData\local\test1" | Rename-Item -NewName "test2" # this renames the file
Copy-Item HOSTNAME\username\AppData\Roaming\test1 -Destination C:\Users\Chris\AppData\Local -Recurse # this copies the "test1" folder onto the destination**
如何获得一个提示窗口,向我显示该FILESERVER路径上的当前用户名?
我可以使用什么来在路径上调用主机名?