Button to mount / unmount a VeraCrypt container


Does anyone have a function with which I can mount or un-mount a VeraCrypt / Truecrypt container?

So with a toggle function - button pressed, the container is mounted and when the button is released, the container is unmounted.

It would be great if the active Lister jumps to the drive letter with which the container was mounted.

Many greetings

This has commands for mounting and unmounting (assuming the old TrueCrypt command line args still work with VeraCrypt):

If those work as individual buttons, you can probably use @ifexists to make them into a single toggle button:

< unmount command here >
< mount command here >

But I'd make sure they work individually first so it's easier to work out where things are going wrong if they don't work. In fact, I'd get the commands correct and working in a Command Prompt first, before involving Opus as all.


Below I've listed a few of my working VeraCrypt buttons.

From the VeraCrypt menu set your /Settings/Preferences.
From the VeraCrypt menu set your Favorites volumes.

Mount/Unmount the Library volume:

@async:/kicks\VeraCrypt\VeraCrypt-x64.exe /q preferences /d v /a /b
cd /kicks\VeraCrypt
@async:/kicks\VeraCrypt\VeraCrypt-x64.exe /q preferences /v %Vault%\Library.hc /l v /a /b

Mount/Unmount the Favorites volume:

@async:/kicks\VeraCrypt\VeraCrypt-x64.exe /q preferences /d /a /b
cd /kicks\VeraCrypt
@async:/kicks\VeraCrypt\VeraCrypt-x64.exe /q preferences /a favorites /b

"/kicks" is my Directory Opus alias.
"%Vault%" is a Windows variable.

Thank you that works.

Is there now an additional function that changes the button according to the state.

As for the buttton to switch between DUAL VIEW.


There isn't a good/reliable way to make a button's visual state depend on whether a drive is mounted, at least that I can think of.

You could do it using variables but then the indicator would go wrong if the variable got out of sync (e.g. if the drive was mounted or unmounted via another method, e.g. shutting down the PC).


I'm glad that the VeraCrypt command lines are working for you. In case you may not have noticed, you should close the Directory Opus window before you execute the VeraCrypt button commands; else you may receive a VeraCrypt error.

I have my VeraCrypt buttons placed on the Directory Opus tray icon; or you could place them on a floating toolbar.

Also, you can dismount VeraCrypt drives by right-clicking the VeraCrypt tray icon; which will trigger a Windows notification. The VeraCrypt command lines circumvent the Windows notifications.

If you need to close any Opus folder tabs that have the drive open before dismounting it, this may be useful as part of the command:


Leo, I appreciate your suggestion for the CloseAllTabs script; I tried it and it seemed to help. I decided to experiment, and uninstalled the CloseAllTabs script, then tried running a VeraCrypt command button -- it worked while Directory Opus was open! It was a good surprise for me. I don't remember how long ago I began relying on my workaround; or if it were caused by DOpus or VerCrypt; but habits often take hold.

I provided some initial help and ended up getting helped myself. Thanks.

1 Like