Question Status: Closed (original question not-resolved; workaround employed; see below)
I'm trying to setup a relatively simple batch file that will mount one volume. I have two batch files, one representing each volume I wish to mount, so I can simply type the batch file name representing the volume I wish to mount. (i.e 'mav' (mount a vol) or 'mbv' (mount b vol)) This way I can mount the volume I need at that time, w/out having to mount all at once. I note "relatively simple batch file" because I have some checks in place to make sure that the device is attached and that I'm running in an elevated state, otherwise it just runs the veracrypt.exe command with arguments (switches).
This issue is not order specific, meaning it doesn't always have to be performed, 'mav' and then 'mbv', for example. (EDIT) Let me rephrase that. It isn't order specific in the aforementioned way, however it IS order specific in that it always happens if there's already a volume mounted, so the second mount attempt is the issue.
I have no problems mounting the first volume and all goes as planned. However, when I mount the second volume, VeraCrypt stays open in the background, halting my script until it's been closed manually.
...I've replaced actual volume IDs with VOLAID or VOLBID...
I know I am choosing "/q background" as one of the arguments (switches), and yes this does declare background, but according to the documentation, if you run "/s /q" it should run silently and then quit the application. It does this for the first run. I even watch task manager and see the VeraCrypt.exe process disappear, thus it closes after it runs the command. It's the fact that I already have a volume mounted that throws this kink. If nothing is mounted, all works fine, thus the first mount is golden but the second mount hangs VeraCrypt.
Upon running the second mount script, it performs up until VeraCrypt actually runs in the background and will not close, and therefore my batch file will not complete because it's waiting for the VeraCrypt command to terminate before the script can continue. So I end up manually closing VeraCrypt, and it mentions the normal warnings and closes. Both mounts stay active at this point and I can read/write to them as I desire.
I've tried variations of the "/s /q background" option, by just running "/s" or just "/q background" or "/q" or "/s /q". All these do is end up keeping the main window open showing the different mounted volumes. Remember, I'm trying to do this quietly / silently in the background so I don't have to interact other than provide the volume password when prompted.
I've even tried running variations of the "start" command (i.e. "start" or "start /b") within the script, but if I do this, VeraCrypt doesn't even start.
Let me lastly mention, that I have to perform this all from an elevated command prompt, as my user account doesn't have rights to running VeraCrypt. This has been a non-issue and I can un/mount the volumes manually through the GUI or the command line w/out incident other than this small hiccup.
Any help would be appreciated.
Last edit: Matt 2017-06-06
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What version of VeraCrypt? And what operating system?
Bit puzzled by your command lines - if you use the /s switch, theoretically this 'suppresses interaction with the user (prompts, error messages, warnings, etc.)'. How do you enter the password?
Last edit: Adrian Kentleton 2017-06-05
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So I've made a small adjustment to my script. Instead of mounting the specific volumes, using the command above, I simply start VeraCrypt (C:> veracrypt.exe /s /q background) Here's the part I didn't mention because I didn't think it had an impact but I've since found out that it does.
I have VeraCrypt configured to auto-mount my favorite volumes and have two volumes marked as favorites. So as soon as the devices are attached, in this case VHDs, then VeraCrypt prompts for the password to mount the device. Since this was already configured, I mistakenly thought that by defining the volume, to mount in my command, this was triggering the password prompt. The truth is, the auto-mount was prompting.
The adjustment, however, has no impact. It still performs the same way. No matter which volume I mount first, it loads just fine and VeraCrypt closes behind it. The second volume mounted ends up leaving VeraCrypt loaded in the task bar, and therefore my script will not terminate because it's waiting on VeraCrypt to close.
OK, so as I'm writing this, I made another and final modification. I'm simply mounting all of the VHDs first, then launching VeraCrypt (C:> veracrypt.exe /s /q background), which then prompts me to enter my passwords for my encrypted volumes. I would have like to keep this more granular but it's OK, I don't mind having all of them load up front. Less steps and all works as I intended.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Question Status: Closed (original question not-resolved; workaround employed; see below)
I'm trying to setup a relatively simple batch file that will mount one volume. I have two batch files, one representing each volume I wish to mount, so I can simply type the batch file name representing the volume I wish to mount. (i.e 'mav' (mount a vol) or 'mbv' (mount b vol)) This way I can mount the volume I need at that time, w/out having to mount all at once. I note "relatively simple batch file" because I have some checks in place to make sure that the device is attached and that I'm running in an elevated state, otherwise it just runs the veracrypt.exe command with arguments (switches).
This issue is not order specific, meaning it doesn't always have to be performed, 'mav' and then 'mbv', for example. (EDIT) Let me rephrase that. It isn't order specific in the aforementioned way, however it IS order specific in that it always happens if there's already a volume mounted, so the second mount attempt is the issue.
I have no problems mounting the first volume and all goes as planned. However, when I mount the second volume, VeraCrypt stays open in the background, halting my script until it's been closed manually.
My commands are:
...I've replaced actual volume IDs with VOLAID or VOLBID...
I know I am choosing "/q background" as one of the arguments (switches), and yes this does declare background, but according to the documentation, if you run "/s /q" it should run silently and then quit the application. It does this for the first run. I even watch task manager and see the VeraCrypt.exe process disappear, thus it closes after it runs the command. It's the fact that I already have a volume mounted that throws this kink. If nothing is mounted, all works fine, thus the first mount is golden but the second mount hangs VeraCrypt.
Upon running the second mount script, it performs up until VeraCrypt actually runs in the background and will not close, and therefore my batch file will not complete because it's waiting for the VeraCrypt command to terminate before the script can continue. So I end up manually closing VeraCrypt, and it mentions the normal warnings and closes. Both mounts stay active at this point and I can read/write to them as I desire.
I've tried variations of the "/s /q background" option, by just running "/s" or just "/q background" or "/q" or "/s /q". All these do is end up keeping the main window open showing the different mounted volumes. Remember, I'm trying to do this quietly / silently in the background so I don't have to interact other than provide the volume password when prompted.
I've even tried running variations of the "start" command (i.e. "start" or "start /b") within the script, but if I do this, VeraCrypt doesn't even start.
Let me lastly mention, that I have to perform this all from an elevated command prompt, as my user account doesn't have rights to running VeraCrypt. This has been a non-issue and I can un/mount the volumes manually through the GUI or the command line w/out incident other than this small hiccup.
Any help would be appreciated.
Last edit: Matt 2017-06-06
What version of VeraCrypt? And what operating system?
Bit puzzled by your command lines - if you use the /s switch, theoretically this 'suppresses interaction with the user (prompts, error messages, warnings, etc.)'. How do you enter the password?
Last edit: Adrian Kentleton 2017-06-05
Question Status: Closed (original question not-resolved; workaround employed)
VeraCrypt version: 1.19
OS: Windows 7 64-bit
So I've made a small adjustment to my script. Instead of mounting the specific volumes, using the command above, I simply start VeraCrypt (C:> veracrypt.exe /s /q background) Here's the part I didn't mention because I didn't think it had an impact but I've since found out that it does.
I have VeraCrypt configured to auto-mount my favorite volumes and have two volumes marked as favorites. So as soon as the devices are attached, in this case VHDs, then VeraCrypt prompts for the password to mount the device. Since this was already configured, I mistakenly thought that by defining the volume, to mount in my command, this was triggering the password prompt. The truth is, the auto-mount was prompting.
The adjustment, however, has no impact. It still performs the same way. No matter which volume I mount first, it loads just fine and VeraCrypt closes behind it. The second volume mounted ends up leaving VeraCrypt loaded in the task bar, and therefore my script will not terminate because it's waiting on VeraCrypt to close.
OK, so as I'm writing this, I made another and final modification. I'm simply mounting all of the VHDs first, then launching VeraCrypt (C:> veracrypt.exe /s /q background), which then prompts me to enter my passwords for my encrypted volumes. I would have like to keep this more granular but it's OK, I don't mind having all of them load up front. Less steps and all works as I intended.