Mapping a network drive without hardcoding a drive letter in a batch file

前端 未结 7 1275
无人及你
无人及你 2020-12-05 19:24

I need to map a network drive with a batch file, but don\'t want to specify the drive letter.

The batch file is used as part of a deployment process; I call the batc

相关标签:
7条回答
  • 2020-12-05 20:00

    i use this to let NET pick a free drive letter, then use NET to find out what letter it assigned:

    net use * \\server\share
    for /f "tokens=2" %%i in ('net use ^| find "\\server\share"') do set netdrive=%%i
    echo %netdrive% has been mapped
    
    0 讨论(0)
提交回复
热议问题