Loading ...
Sorry, an error occurred while loading the content.

set correct drive letter

Expand Messages
  • Aristos Vasiliou
    Hi, I have 5 USB hard disks for backing up data on a server. One for each day of the week. All the hard disks are labeled for each day of the week (Monday to
    Message 1 of 9 , Mar 1 5:49 AM
    • 0 Attachment
      Hi,



      I have 5 USB hard disks for backing up data on a server. One for each day of the week.

      All the hard disks are labeled for each day of the week (Monday to Friday)
      I am using Handy backup for backing up the data.
      Handy backup is configured to send the backup on a specific drive letter.

      The problem is that some times when changing the USB hard disk, it doesn�t always get the same drive letter as the previous USB hard disk had. So Handy backup cannot find a hard disk and the backup fails.

      Handy backup allows me to run a program before running the backup.

      So my question is, is there a way that a batch file would check if the USB hard disk has the drive letter it should have, and if it doesn�t, change it to the one it should have?

      Thanks


      [Non-text portions of this message have been removed]
    • foxidrive
      ... It s possible that another USB device already has the drive letter you need so changing it (if it can be done) could cause problems. Can you alter Handy
      Message 2 of 9 , Mar 1 5:58 AM
      • 0 Attachment
        On 2/03/2011 00:49, Aristos Vasiliou wrote:
        > Hi,
        >
        >
        >
        > I have 5 USB hard disks for backing up data on a server. One for each
        > day of the week.
        >
        > All the hard disks are labeled for each day of the week (Monday to
        > Friday) I am using Handy backup for backing up the data. Handy backup
        > is configured to send the backup on a specific drive letter.
        >
        > The problem is that some times when changing the USB hard disk, it
        > doesn’t always get the same drive letter as the previous USB hard
        > disk had. So Handy backup cannot find a hard disk and the backup
        > fails.
        >
        > Handy backup allows me to run a program before running the backup.
        >
        > So my question is, is there a way that a batch file would check if
        > the USB hard disk has the drive letter it should have, and if it
        > doesn’t, change it to the one it should have?


        It's possible that another USB device already has the drive letter you
        need so changing it (if it can be done) could cause problems.

        Can you alter Handy Backup in an automatic way, if you use a batch file
        to detect the current drive letter?
      • abhijat.singh@ubs.com
        ... From: batchworld@yahoogroups.com [mailto:batchworld@yahoogroups.com] On Behalf Of foxidrive Sent: Tuesday, March 01, 2011 8:59 AM To:
        Message 3 of 9 , Mar 1 6:01 AM
        • 0 Attachment
          -----Original Message-----
          From: batchworld@yahoogroups.com [mailto:batchworld@yahoogroups.com] On
          Behalf Of foxidrive
          Sent: Tuesday, March 01, 2011 8:59 AM
          To: batchworld@yahoogroups.com
          Subject: Re: [BATCH WORLD] set correct drive letter

          On 2/03/2011 00:49, Aristos Vasiliou wrote:
          > Hi,
          >
          >
          >
          > I have 5 USB hard disks for backing up data on a server. One for each
          > day of the week.
          >
          > All the hard disks are labeled for each day of the week (Monday to
          > Friday) I am using Handy backup for backing up the data. Handy backup
          > is configured to send the backup on a specific drive letter.
          >
          > The problem is that some times when changing the USB hard disk, it
          > doesn't always get the same drive letter as the previous USB hard disk

          > had. So Handy backup cannot find a hard disk and the backup fails.
          >
          > Handy backup allows me to run a program before running the backup.
          >
          > So my question is, is there a way that a batch file would check if the

          > USB hard disk has the drive letter it should have, and if it doesn't,
          > change it to the one it should have?


          I know the dos command to map a drive to a particular alphabet. I use it
          a part of startup script when I login to my machine.
          It is " net use X: \\drive_path\folder_name "

          Kind Regards,
          Abhijat


          ------------------------------------

          To Post a message, send it to: batchworld@...

          To Unsubscribe, send a blank message to:
          batchworld-unsubscribe@...! Groups Links



          Visit our website at http://www.ubs.com

          This message contains confidential information and is intended only
          for the individual named. If you are not the named addressee you
          should not disseminate, distribute or copy this e-mail. Please
          notify the sender immediately by e-mail if you have received this
          e-mail by mistake and delete this e-mail from your system.

          E-mails are not encrypted and cannot be guaranteed to be secure or
          error-free as information could be intercepted, corrupted, lost,
          destroyed, arrive late or incomplete, or contain viruses. The sender
          therefore does not accept liability for any errors or omissions in the
          contents of this message which arise as a result of e-mail transmission.
          If verification is required please request a hard-copy version. This
          message is provided for informational purposes and should not be
          construed as a solicitation or offer to buy or sell any securities
          or related financial instruments.


          UBS reserves the right to retain all messages. Messages are protected
          and accessed only in legally justified cases.
        • Aristos Vasiliou
          If I choose a high enough drive letter, (X, Y, Z) I will be sure that no device will use it. But still, some times the hard disk will not get the next
          Message 4 of 9 , Mar 1 6:13 AM
          • 0 Attachment
            If I choose a high enough drive letter, (X, Y, Z) I will be sure that no device will use it. But still, some times the hard disk will not get the next available drive letter. That’s why I thought of a batch file to check first. Unfortunately Handy backup cannot automatically detect the drive’s current drive letter.

            ________________________________________
            From: batchworld@yahoogroups.com [batchworld@yahoogroups.com] on behalf of foxidrive [foxidrive@...]
            Sent: 01 March 2011 15:58
            To: batchworld@yahoogroups.com
            Subject: Re: [BATCH WORLD] set correct drive letter

            On 2/03/2011 00:49, Aristos Vasiliou wrote:
            > Hi,
            >
            >
            >
            > I have 5 USB hard disks for backing up data on a server. One for each
            > day of the week.
            >
            > All the hard disks are labeled for each day of the week (Monday to
            > Friday) I am using Handy backup for backing up the data. Handy backup
            > is configured to send the backup on a specific drive letter.
            >
            > The problem is that some times when changing the USB hard disk, it
            > doesn’t always get the same drive letter as the previous USB hard
            > disk had. So Handy backup cannot find a hard disk and the backup
            > fails.
            >
            > Handy backup allows me to run a program before running the backup.
            >
            > So my question is, is there a way that a batch file would check if
            > the USB hard disk has the drive letter it should have, and if it
            > doesn’t, change it to the one it should have?


            It's possible that another USB device already has the drive letter you
            need so changing it (if it can be done) could cause problems.

            Can you alter Handy Backup in an automatic way, if you use a batch file
            to detect the current drive letter?




            ------------------------------------

            To Post a message, send it to: batchworld@...

            To Unsubscribe, send a blank message to: batchworld-unsubscribe@...! Groups Links



            http://docs.yahoo.com/info/terms/
          • foxidrive
            ... What you could do is detect the drive letter by a batch file and then change the INI file/registry key for Handy backup.
            Message 5 of 9 , Mar 1 6:25 AM
            • 0 Attachment
              On 2/03/2011 01:13, Aristos Vasiliou wrote:
              > If I choose a high enough drive letter, (X, Y, Z) I will be sure that no device will use it. But still, some times the hard disk will not get the next available drive letter. That’s why I thought of a batch file to check first. Unfortunately Handy backup cannot automatically detect the drive’s current drive letter.
              >
              > ________________________________________
              > From: batchworld@yahoogroups.com [batchworld@yahoogroups.com] on behalf of foxidrive [foxidrive@...]
              > Sent: 01 March 2011 15:58
              > To: batchworld@yahoogroups.com
              > Subject: Re: [BATCH WORLD] set correct drive letter
              >
              > On 2/03/2011 00:49, Aristos Vasiliou wrote:
              >> Hi,
              >>
              >>
              >>
              >> I have 5 USB hard disks for backing up data on a server. One for each
              >> day of the week.
              >>
              >> All the hard disks are labeled for each day of the week (Monday to
              >> Friday) I am using Handy backup for backing up the data. Handy backup
              >> is configured to send the backup on a specific drive letter.
              >>
              >> The problem is that some times when changing the USB hard disk, it
              >> doesn’t always get the same drive letter as the previous USB hard
              >> disk had. So Handy backup cannot find a hard disk and the backup
              >> fails.
              >>
              >> Handy backup allows me to run a program before running the backup.
              >>
              >> So my question is, is there a way that a batch file would check if
              >> the USB hard disk has the drive letter it should have, and if it
              >> doesn’t, change it to the one it should have?
              >
              >
              > It's possible that another USB device already has the drive letter you
              > need so changing it (if it can be done) could cause problems.
              >
              > Can you alter Handy Backup in an automatic way, if you use a batch file
              > to detect the current drive letter?


              What you could do is detect the drive letter by a batch file and then
              change the INI file/registry key for Handy backup.
            • Aristos Vasiliou
              A colleague suggested that I use this, But I would prefer your opinion. @echo off set day=%date:~0,3% if /i %day% == mon set ADL=P if /i %day% == tue set ADL=q
              Message 6 of 9 , Mar 1 6:38 AM
              • 0 Attachment
                A colleague suggested that I use this, But I would prefer your opinion.

                @echo off
                set day=%date:~0,3%
                if /i %day% == mon set ADL=P
                if /i %day% == tue set ADL=q
                if /i %day% == WED set ADL=r
                if /i %day% == thu set ADL=s
                if /i %day% == FRY set ADL=t
                echo today is %day% and so Drive letter will be %ADL%
                echo list volume >%temp%\dskprt.txt
                diskpart /s %temp%\dskprt.txt | find /i "%DAY%" >Volume.txt
                for /f "tokens=3" %%a in (volume.txt) do (
                echo USB drive current volume letter = %%a
                set DL=%%a
                )
                echo. Checking drive letter ..
                if /i %DL% == %ADL% (
                echo Drive letter already assigned ..good to go..
                echo Press enter to exit
                pause
                )
                if /i not %DL% == %ADL% (
                echo. drive letter mismatch..attempting to assign new one
                echo removing existing drive letter and assiging required one
                echo select volume %DL% >%temp%\dskprt1.txt
                echo remove letter=%DL% >>%temp%\dskprt1.txt
                echo assign letter=%ADL%>>%temp%\dskprt1.txt
                diskpart /s %temp%\dskprt1.txt
                )

                ________________________________________
                From: batchworld@yahoogroups.com [batchworld@yahoogroups.com] on behalf of foxidrive [foxidrive@...]
                Sent: 01 March 2011 16:25
                To: batchworld@yahoogroups.com
                Subject: Re: [BATCH WORLD] set correct drive letter

                On 2/03/2011 01:13, Aristos Vasiliou wrote:
                > If I choose a high enough drive letter, (X, Y, Z) I will be sure that no device will use it. But still, some times the hard disk will not get the next available drive letter. That’s why I thought of a batch file to check first. Unfortunately Handy backup cannot automatically detect the drive’s current drive letter.
                >
                > ________________________________________
                > From: batchworld@yahoogroups.com [batchworld@yahoogroups.com] on behalf of foxidrive [foxidrive@...]
                > Sent: 01 March 2011 15:58
                > To: batchworld@yahoogroups.com
                > Subject: Re: [BATCH WORLD] set correct drive letter
                >
                > On 2/03/2011 00:49, Aristos Vasiliou wrote:
                >> Hi,
                >>
                >>
                >>
                >> I have 5 USB hard disks for backing up data on a server. One for each
                >> day of the week.
                >>
                >> All the hard disks are labeled for each day of the week (Monday to
                >> Friday) I am using Handy backup for backing up the data. Handy backup
                >> is configured to send the backup on a specific drive letter.
                >>
                >> The problem is that some times when changing the USB hard disk, it
                >> doesn’t always get the same drive letter as the previous USB hard
                >> disk had. So Handy backup cannot find a hard disk and the backup
                >> fails.
                >>
                >> Handy backup allows me to run a program before running the backup.
                >>
                >> So my question is, is there a way that a batch file would check if
                >> the USB hard disk has the drive letter it should have, and if it
                >> doesn’t, change it to the one it should have?
                >
                >
                > It's possible that another USB device already has the drive letter you
                > need so changing it (if it can be done) could cause problems.
                >
                > Can you alter Handy Backup in an automatic way, if you use a batch file
                > to detect the current drive letter?


                What you could do is detect the drive letter by a batch file and then
                change the INI file/registry key for Handy backup.





                ------------------------------------

                To Post a message, send it to: batchworld@...

                To Unsubscribe, send a blank message to: batchworld-unsubscribe@...! Groups Links



                http://docs.yahoo.com/info/terms/
              • foxidrive
                Don t top post, please. The code you provided doesn t take into account the situation where another drive already has the drive letter assigned. What you could
                Message 7 of 9 , Mar 1 6:58 AM
                • 0 Attachment
                  Don't top post, please.



                  The code you provided doesn't take into account the situation where
                  another drive already has the drive letter assigned.


                  What you could do is detect the drive letter by a batch file and then
                  change the INI file/registry key for Handy backup so that it uses the
                  drive letter that is assigned.
                • Aristos Vasiliou
                  ________________________________________ From: batchworld@yahoogroups.com [batchworld@yahoogroups.com] on behalf of foxidrive [foxidrive@lavabit.com] Sent: 01
                  Message 8 of 9 , Mar 1 7:03 AM
                  • 0 Attachment
                    ________________________________________
                    From: batchworld@yahoogroups.com [batchworld@yahoogroups.com] on behalf of foxidrive [foxidrive@...]
                    Sent: 01 March 2011 16:58
                    To: batchworld@yahoogroups.com
                    Subject: Re: [BATCH WORLD] set correct drive letter

                    Don't top post, please.



                    The code you provided doesn't take into account the situation where
                    another drive already has the drive letter assigned.


                    What you could do is detect the drive letter by a batch file and then
                    change the INI file/registry key for Handy backup so that it uses the
                    drive letter that is assigned.

                    I will give it a try. Thanks.
                    ------------------------------------

                    To Post a message, send it to: batchworld@...

                    To Unsubscribe, send a blank message to: batchworld-unsubscribe@...! Groups Links



                    http://docs.yahoo.com/info/terms/
                  • rowlfe
                    OK, so if I understand correctly, you are connecting a USB drive, then you want to do a backup to that drive and you need to reassign the drive letter to one
                    Message 9 of 9 , Mar 2 9:32 AM
                    • 0 Attachment
                      OK, so if I understand correctly, you are connecting a USB drive, then you want to do a backup to that drive and you need to reassign the drive letter to one that is known to your backup program. I must be missing something, why would the drive letter NOT be known in advance? Why will the next drive letter be different from day to day when you connect the USB drive? OK, so at least, you will need a list of the possible drive letters it COULD be to use this. In my case, F: is the next drive, and I made a list of D: E: F: G: and H: as possible assignments. In my case, D: and E: are USB drives I already have connected, but may not be there later. So, my backup target drive COULD be D: E: F: G: or H: because I have room for 5 connected USB drives on my laptop plus hub.

                      Here is a batch file that will find a drive by locating a file named "drive.id" in the root directory of possible drive letters. Only the drive I want has this unique file named "drive.id". It assigns the drive letter to a variable. It then designates this found drive as a new share named "sharedrive". It then assigns this share to drive letter X:. Then I can run the backup program which I previously set up to use X: as the target. The key is the unique file NAME in the root of the target for the backup. In your case, all you need do is place the same unique file name in the root of EACH of the 5 target drives that you rotate through each day.

                      -=+=- START -=+=-

                      rem @echo off
                      rem - I remarked out the echo off to watch it work line by line

                      cls

                      if exist x:\drive.id net use x: /delete
                      rem - remove X: if it is there already

                      net share sharedrive /delete
                      rem - remove share if set already

                      PAUSE
                      rem - remove pause after debugging is done

                      set drv=z:
                      rem - variable "drv" will hold the drive if found

                      for %%a in ( d: e: f: g: h: ) do if exist %%a/drive.id set drv=%%a
                      rem - locate unique file name in drive list
                      rem - my possible drive list is D E F G and H
                      rem - change drive list to fit your machine

                      if [%drv%]==[z:] goto nogo
                      rem - error trap for file not found

                      echo.variable DRV=[%drv%]
                      PAUSE
                      rem - remove echo and pause after debugging done

                      net share sharedrive=%drv%
                      rem - assign the share

                      net use x: \\FRITZ-826504500\sharedrive
                      rem - assign the share a drive letter
                      rem - "FRITZ-826504500" is my computer name

                      IF EXIST X:\DRIVE.ID DIR X:
                      rem - If you see a DIR of the desired drive, it worked.
                      rem - you would call your backup program here and exit

                      goto eof
                      rem - jump over the error trap message and exit

                      :nogo
                      echo.OOPS! Drive NOT found!
                      rem - display error message and exit.
                      rem - Do whatever you want here.

                      :eof

                      -=+=- END -=+=-

                      Give this a whirl...

                      It worked on the pld Win 2K laptop I am using at the moment. What you would do is put in your backup program where I used a simple DIR command if the unique file name existed as the desired drive X:. You would also put in your own error handler in place of my simple OOPS! message. I literally did a copy and paste from the batch file I created between the -=+=- markers above, including all of the remarks. I leave it as an exercise for the student to clean it up and make it look nice and pretty...

                      Let me know if this works for you, OK?

                      Ralph



                      --- In batchworld@yahoogroups.com, Aristos Vasiliou <aristos@...> wrote:
                      >
                      >
                      >
                      > ________________________________________
                      > From: batchworld@yahoogroups.com [batchworld@yahoogroups.com] on behalf of foxidrive [foxidrive@...]
                      > Sent: 01 March 2011 16:58
                      > To: batchworld@yahoogroups.com
                      > Subject: Re: [BATCH WORLD] set correct drive letter
                      >
                      > Don't top post, please.
                      >
                      >
                      >
                      > The code you provided doesn't take into account the situation where
                      > another drive already has the drive letter assigned.
                      >
                      >
                      > What you could do is detect the drive letter by a batch file and then
                      > change the INI file/registry key for Handy backup so that it uses the
                      > drive letter that is assigned.
                      >
                      > I will give it a try. Thanks.
                      > ------------------------------------
                      >
                      > To Post a message, send it to: batchworld@...
                      >
                      > To Unsubscribe, send a blank message to: batchworld-unsubscribe@...! Groups Links
                      >
                      >
                      >
                      > http://docs.yahoo.com/info/terms/
                      >
                    Your message has been successfully submitted and would be delivered to recipients shortly.