中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-11 09:46
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » [fixed] How can a batch file open a removable hard drive?
Printable Version  953 / 5
Floor1 zhangwencheng Posted 2009-02-07 15:15
初级用户 Posts 45 Credits 68
When I don't know the drive letter of the removable hard drive, how can I open the removable hard drive? (using a batch file)

───────────────── Moderator record ─────────────────
Executed by: HAT
Action: At the OP's request, this thread was moved from the Batch File Room to the Windows section
───────────────── Moderator record ─────────────────


[ Last edited by HAT on 2009-2-8 at 22:07 ]
Floor2 HAT Posted 2009-02-08 00:30
版主 Posts 5,017 Credits 9,023
Search this section for "removable hard drive"

Q: How can I use the forum's search function to solve my own problem?
A: Refer to: http://www.cn-dos.net/forum/viewthread.php?tid=44122#pid308085
Floor3 gdyabc Posted 2009-02-08 14:44
初级用户 Posts 37 Credits 41 From 四川南充
Give this a try. I tested it on my own machine and it worked, so try it. If it doesn't work, then ask someone else for help.
Actually, fastslz posted this a long time ago. I only added the last one or two lines of code; the rest of the code is from fastslzr.
@echo off
for /f "tokens=3* delims=," %%i in ('WMIC Path Win32_LogicalDisk Get DeviceID^,FileSystem^,Description /format:csv^|find /i "移动"') do call set USBDisk=%%USBDisk%% %%i
echo %USBDisk:~1%>test.txt
for /f %%a in (test.txt) Do set gdyabc=%%a
del /q test.txt
%gdyabc% && start .

[ Last edited by gdyabc on 2009-2-18 at 07:18 ]
Floor4 zhangwencheng Posted 2009-02-08 21:36
初级用户 Posts 45 Credits 68
The one in post #3 works!
Many thanks!
Floor5 DOSroot Posted 2009-02-09 16:21
管理员 Posts 198 Credits 389
This problem is completely solved by batch-file methods; it's not some system usage or settings problem. Why does zhangwencheng think it should be posted in the "General Operating Systems Discussion" section?

If there are no objections, I'll move it back to the "Batch File Room".
Floor6 LQDi1982 Posted 2009-02-13 19:13
新手上路 Posts 14 Credits 14
Post #3 is awesome, there's no end to learning...
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023