Jump to content

[Version 1] Windows Drive Letter Question

Recommended Posts

This is probably a silly question, but honestly I almost never use Windows, soooo...

I'm working on a new example application that will make use of the USB disk feature in 0.9, and demonstrate a number of more advanced I/O concepts. I wrote a little application and compiled it to a .EXE, which will be stored on the USB disk. The EXE works. That was the easy part (actually, I wrote and tested it in Linux, then ported to Windows)

So, the main question is how do I figure out the drive letter that Windows assigns, so I can run it at the command prompt? Or is the some way to run it without knowing the drive letter?

Specifically, the device is plugged in. The HID keyboard types Win-R, then "CMD". Then I wait a bit for Windows to detect the disk. If I knew the drive letter in advance, I could just have the keyboard type something like "E:\MYTEST.EXE" to run it. But I don't know if the drive letter will be E:, F:, G: or whatever.

Any ideas? I'm sure this is probably very obvious to you folks who know Windows so well.

Link to comment
Share on other sites

for /F %a in ('WMIC logicaldisk list brief ^| find "VOLLABEL"') do %a\mytest.exe

Replace VOLLABEL with the flash drive's volume label

Awesome, thanks! Works great. :)

I had to add the ability to assign a volume label when using the internal memory for USB disk. I guess now I should probably add info about that to the auto-generated readme file and upload a new Teensyduino....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...