模拟网络文件夹以在 powershell 脚本中进行测试

Al *_*aba 1 windows powershell batch-file

有没有办法模拟网络驱动器以在 Windows 上测试我的 powershell 脚本。例如,我有需要复制到的文件

\\192.168.218.80\foo\2019\0815 
Run Code Online (Sandbox Code Playgroud)

但是在我的开发机器上没有这样的驱动器。有没有办法模拟/模拟这个,以便我可以测试复制过程?

Ben*_*est 5

使用 UNC 路径使用本地管理共享:

\\localhost\C$\2019\0815
Run Code Online (Sandbox Code Playgroud)

或者

\\127.0.0.1\C$\2019\0815
Run Code Online (Sandbox Code Playgroud)

请注意,对于任何本地安装的字母驱动器,C$is C:D$would beD:等等。目录挂载点在挂载到的盘符驱动器路径下仍然可用。但是,网络安装的字母驱动器不能作为这样的管理共享使用。