locked
Batch file problems RRS feed

  • Question

  • Hello all, quick question: This has already worked but for whatever reason doesn't work anymore...

    Was using those batch files to mount and unmount Volume in Windows:

    Mounting:

    @echo off

    REM Be sure to change this to the drive letter you want to mount the drive to!

    set drive=E

    REM Be sure to change this to the Volume Name of the drive you want to mount!

    set volume=\\?\Volume{52ade1a4-0fd4-44cd-aa69-bfda739bb9e6}\

    set volume=\\?\Volume{4d654d26-f65d-4c67-b83c-876de0d6820b}\

    set volume=\\?\Volume{59cc5e85-9403-425f-bd28-c22ed4e8ab8d}\

    set volume=\\?\Volume{52fdf924-f0fb-4ba7-99e0-096a9c9d124a}\

    :start
    echo Mounting Drive...
    mountvol %drive%: %volume%
    echo Drive Mounted!

    exit

    Unmount:

    @echo off

    REM Be sure to change this to the drive you want to unmount! 
    set drive=E:

    echo Unmounting Drive...
    mountvol %drive% /p
    echo Drive Unmounted!

    exit

    Since a while this is not working anymore. Any help would be really appreciated. Hard drive connected by USB docking station.

    Regards,


    Michel Marcouiller PES/ISS


    Friday, December 13, 2019 8:22 PM

Answers

  • There is really no way to know what is not working. If you had posted the files correctly so we could see that there were two then it would have been easier. The files will do what they are coded to do. Ask the person who wrote them for help as we cannot know what is supposed to happen or why they don't so what you want. There is not enough information.

    I can Also suggest contacting the vendor of your backup software for help.

    Noe that this forum is not support forum.  It is a forum for people to ask questions about scripts they have written.  We cannot answer questions about how third party products work or fail. 


    \_(ツ)_/

    • Marked as answer by Marcouillerm Monday, December 16, 2019 3:24 PM
    Monday, December 16, 2019 3:19 PM

All replies

  • Please post code correctly using the code posting tool provided.

    As posted your ode looks like it could never have worked.  It will always exit at the first "exit" command.

    If this is more than one file then you need to make that clear.  Also you must tell us what the error is.

    We do not fix code that you have found or that has been written for others.  If this is not your code then contact the author for instructions on how to use it.


    \_(ツ)_/

    Saturday, December 14, 2019 4:22 AM
  • Hello, it's quite simple... Under Mounting: it's the code to mount the drive. Under Unmount: it's the code to unmount it.

    Regards,


    Michel Marcouiller PES/ISS

    Monday, December 16, 2019 1:22 PM
  • The code posted does not do that. It just exits at the first exit line.

    We have no way of knowing what you are trying to do.  You should not be using batch files as they are mostly deprecated and there is no point in learning a technology that is obsolete.

    The is no point in scripting mount and unmount as the commands do that without needing to be scripted.

    A line with beginning with a word that ends with a colon is a label that we can "go to".  It is used to jump in a batch file.  The labels serve no purpose in this file as they are never used.

    It is likely that you or someone else has edited this file and broken whatever purpose it served.

    Again, there is not reason to use a batch file to mount volumes but a sequence of mounts and unmounts in a file can be used for convenience.  The file you posted just doesn't make any sense.  It just mounts one volume and exits.  It likely never worked or it was changed.  In any case there is no way to know what you are trying todo.


    \_(ツ)_/

    Monday, December 16, 2019 1:59 PM
  • Hi, I was using those 2 batch files to mount my volume before a backup and to unmount it after the backup. The program runs the first batch file (Mounting) and runs the backup. At the end, the last backup rules run the batch file to unmount the drive.

    Better this way?

    Regards,


    Michel Marcouiller PES/ISS

    Monday, December 16, 2019 2:51 PM
  • There is really no way to know what is not working. If you had posted the files correctly so we could see that there were two then it would have been easier. The files will do what they are coded to do. Ask the person who wrote them for help as we cannot know what is supposed to happen or why they don't so what you want. There is not enough information.

    I can Also suggest contacting the vendor of your backup software for help.

    Noe that this forum is not support forum.  It is a forum for people to ask questions about scripts they have written.  We cannot answer questions about how third party products work or fail. 


    \_(ツ)_/

    • Marked as answer by Marcouillerm Monday, December 16, 2019 3:24 PM
    Monday, December 16, 2019 3:19 PM
  • ok, thanks for your help!

    Regards,


    Michel Marcouiller PES/ISS

    Monday, December 16, 2019 3:24 PM