Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想运行一个批处理脚本来运行非交互式方法来连接其他网络共享驱动器。
但是,我不想在 net use 命令中硬编码密码。
请建议任何其他连接网络共享驱动器的方法?
谢谢。
您没有提到要隐藏凭据,只是不想将它们硬编码到批处理文件中,因此您可以将用户名和密码放在外部文件中,然后通过读取这些文件来设置变量。
设置 /p 用户名=
净使用 x:\server\share /user:%username% %pass%
之后,如果您需要隐藏密码,则可以将其放在文件的备用流中并从脚本中读取。