每隔一段时间,我以管理员用户身份运行 cmd。为了方便起见,我设置了一个快捷方式......
C:\Windows\System32\runas.exe /u:admin.user@domain cmd
Run Code Online (Sandbox Code Playgroud)
在某些时候,我想运行指向我的普通用户可用的映射驱动器的脚本。
C:\Windows\system32>net use
Status Local Remote Network
-------------------------------------------------------------------------------
Unavailable L: \\fileserver\shared\path
Microsoft Windows Network
Unavailable X: \\fileserver\shared\temp Microsoft Windows Network
The command completed successfully.
Run Code Online (Sandbox Code Playgroud)
我对让我的 L: 驱动器映射特别感兴趣。我认为这样的事情应该有效......
C:\Windows\system32>net use l:
Local name l:
Remote name \\fileserver\shared\path
Resource type Disk
The command completed successfully.
C:\Windows\system32>l:
The system cannot find the drive specified.
Run Code Online (Sandbox Code Playgroud)
如果我重新映射驱动器,一切都很愉快,但它是一件苦差事(实际上“路径”要长得多)。
C:\Windows\system32>net use l: \\fileserver\shared\path
The command completed successfully.
C:\Windows\system32>l:
L:\>
Run Code Online (Sandbox Code Playgroud)