You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

通过winrs远程映射网络驱动器报错:系统找不到指定驱动器

WinRS映射网络驱动器报错问题排查与解决

问题场景

在machine1上以管理员身份执行以下WinRS命令:

winrs -r:machine2 "net use U: \\bosln0\sore45 /persistent:yes & cd U:\ples\prefile\filesreg & echo abc"

出现报错:

U: has a remembered connection to \bosln0\sore45. Do you
want to overwrite the remembered connection? (Y/N) [Y]: No valid response was provided.

The system cannot find the drive specified.
abc

但执行本地目录操作的命令无异常:

winrs -r:machine2 "cd C:\ples\prefile\filesreg & echo abc"

问题原因

  1. 非交互式会话限制:WinRS属于非交互式远程会话,当net use检测到U盘已存在记忆连接时,会弹出交互式确认提示,但远程会话无法接收用户输入,导致确认失败,驱动器映射未完成,后续cd命令因找不到驱动器报错。
  2. 权限会话隔离:管理员权限的WinRS会话与普通用户会话的网络驱动器映射是独立隔离的,即使普通用户曾映射过该驱动器,管理员会话无法直接复用,反而会触发覆盖提示。
  3. 本地目录无映射依赖:操作本地目录无需额外映射步骤,直接可访问,因此不会出现这类交互阻塞问题。

解决方法

  • 强制覆盖映射:在net use命令中添加/y参数,自动确认覆盖已存在的连接,跳过交互式提示:
    winrs -r:machine2 "net use U: \\bosln0\sore45 /persistent:yes /y & cd U:\ples\prefile\filesreg & echo abc"
    
  • 先删再建映射:如果需要清理旧映射后再创建新连接,可先执行删除命令:
    winrs -r:machine2 "net use U: /delete /y & net use U: \\bosln0\sore45 /persistent:yes & cd U:\ples\prefile\filesreg & echo abc"
    
  • 直接使用UNC路径:跳过驱动器映射步骤,直接用UNC路径访问目标目录,彻底避免驱动器冲突:
    winrs -r:machine2 "cd \\bosln0\sore45\ples\prefile\filesreg & echo abc"
    

内容的提问来源于stack exchange,提问作者PPP

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.04 08:30:42