Windows Batch Script Get Current Drive name

前端 未结 8 1776
情话喂你
情话喂你 2021-02-02 09:30

I have a batch file which is on a usb key. I need to know the drive name the batch is in.

Example, if it\'s E:\\mybatch.bat it should find E:\\ same thing for F:\\, G:\\

8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-02 10:01

    M$ documentation "Using batch parameters" says:

    Modifier: %~d0

    Description: Expands %0 to a drive letter.

提交回复
热议问题