Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How to determine what drive a USB would be on  (Read 3794 times)

0 Members and 1 Guest are viewing this topic.

BatchFileCommand

    Topic Starter


    Hopeful
  • Thanked: 1
    How to determine what drive a USB would be on
    « on: March 02, 2009, 07:36:15 PM »
    How would you determine what drive a USB would be on? Because the drive can vary depending on the computer.
    οτη άβγαλτος μεταφ βαθμολογία

    macdad-



      Expert

      Thanked: 40
      Re: How to determine what drive a USB would be on
      « Reply #1 on: March 02, 2009, 07:42:28 PM »
      you want to do this in batch?
      If you dont know DOS, you dont know Windows...

      Thats why Bill Gates created the Windows NT Family.

      BatchFileCommand

        Topic Starter


        Hopeful
      • Thanked: 1
        Re: How to determine what drive a USB would be on
        « Reply #2 on: March 02, 2009, 07:56:24 PM »
        Yes. If it's not possible that's understandable.
        οτη άβγαλτος μεταφ βαθμολογία

        macdad-



          Expert

          Thanked: 40
          Re: How to determine what drive a USB would be on
          « Reply #3 on: March 02, 2009, 07:59:41 PM »
          i think it could be possible...give me a second...i'll whip up a script.
          If you dont know DOS, you dont know Windows...

          Thats why Bill Gates created the Windows NT Family.

          macdad-



            Expert

            Thanked: 40
            Re: How to determine what drive a USB would be on
            « Reply #4 on: March 03, 2009, 06:57:47 AM »
            ok here's the script:

            just put the batch file in the USB drive and it will get the Drive letter of the USB drive:
            Code: [Select]
            @echo off
            title GetDrive Letter
            cd > temp.tmp
            set /p return=<temp.tmp
            set parentdrive=%return:~0,1%
            del temp.tmp
            echo The Drive letter of this USB Drive is: %parentdrive%
            pause

            Hope this Helps
            ,Nick(macdad-)
            If you dont know DOS, you dont know Windows...

            Thats why Bill Gates created the Windows NT Family.

            devcom



              Apprentice

              Thanked: 37
              Re: How to determine what drive a USB would be on
              « Reply #5 on: March 03, 2009, 06:58:36 AM »
              i dont know if you have wmic but here it is
              Code: [Select]
              C:\Users\_CORE>wmic volume get DriveType,Name
              DriveType  Name
              3          C:\
              3          F:\
              3          D:\
              3          E:\
              5          G:\
              2          H:\

              i think that DriveType 2 is USB and 3 is SCSI  ;)
              Download: Choice.exe

              devcom



                Apprentice

                Thanked: 37
                Re: How to determine what drive a USB would be on
                « Reply #6 on: March 03, 2009, 07:02:41 AM »
                ok here's the script:

                just put the batch file in the USB drive and it will get the Drive letter of the USB drive:
                Code: [Select]
                @echo off
                title GetDrive Letter
                cd > temp.tmp
                set /p return=<temp.tmp
                set parentdrive=%return:~0,1%
                del temp.tmp
                echo The Drive letter of this USB Drive is: %parentdrive%
                pause

                Hope this Helps
                ,Nick(macdad-)

                why not use for loop ?  ;)

                Code: [Select]
                for /f %%a in ('echo %cd%') do set var=%%a
                set var=%var:~0,3%
                echo %var%
                Download: Choice.exe

                macdad-



                  Expert

                  Thanked: 40
                  Re: How to determine what drive a USB would be on
                  « Reply #7 on: March 03, 2009, 07:10:49 AM »
                  should of thought of that, either will do.
                  If you dont know DOS, you dont know Windows...

                  Thats why Bill Gates created the Windows NT Family.

                  BatchFileCommand

                    Topic Starter


                    Hopeful
                  • Thanked: 1
                    Re: How to determine what drive a USB would be on
                    « Reply #8 on: March 03, 2009, 04:07:05 PM »
                    Of course  ::). Maybe I should think these things through.
                    οτη άβγαλτος μεταφ βαθμολογία