📜 ⬆️ ⬇️

Organization of data on usb-flash

Many people use launcher programs to organize data on usb-flash. I didn't like any of them and I want to tell you how I made my own, based on the bat-files and Launchy.

As I told you a long time ago , all the data on a flash drive I have is stored in an encrypted container TrueCrypt, so the flash drive has the following structure:
/ secure
/ truecrypt / (here is the TrueCrypt program itself)
/truecrypt.vol (container)
/mount.bat (batch script that mounts a container always as a S drive: which simplifies configuration)
/umount.bat (batch script unmounting the container)
All scripts that are listed in the post, posted in public access (see. At the end)

Item number 1. Launchy setup
Install Launchy, customize it, enable it in Portable Mode settings and copy it to a protected section.
Tip: Try to use paths that are independent of the computer or the current user, for example,% USERPROFILE% \ Start Menu for programs in the Start menu.

Item number 2. Creating shortcuts for portable programs
I placed all .lnk files on an unsecured partition in the same / secure folder. Add the / secure folder to the Launchy directory. Here I met with a small problem that I hadn’t yet solved for myself - in this case, no environment variable can be used, and a flash drive can be connected to different disks on different computers. Therefore, I added D: \ secure, E: \ secure, F: \ secure and G: \ secure folders to Launchy for now :)
')
Item number 3. Launchy autorun
The autorun.inf file launches mount.bat, a script that mounts the TrueCrypt container. There I added Launchy launch.
To close Launchy before unmounting, a taskkill / f / IM launchy.exe instruction was added to the umount.bat script, which kills Launchy so that it does not interfere with unmounting. Rude, but it works.
The most joyful thing is that you can run the umount.bat script from the same Launchy.

Item number 4. Check for unmount
This is for convenience only. Unlocker program can show processes that use the disk. Add a batch file with the “unlocker.exe S:” instruction to the same one and compile it into an .exe for beauty. Now, before calling umount, which Launchy will kill in any case, and the container may not be unmounted, you can execute an unlocker that will show blocking processes (Launchy will be among them anyway, but we don’t care).
Of course, I would like to check before unmounting whether there are any blocking processes and, if so, then run this utility, but batch scripts are not capable of such difficulties (in any case, I did not succeed)

Item number 5. Running the procedure for automatically removing the flash drive after unmounting
Create another batch script eject.bat with contents
call umount.bat
\ secure \ unlocker \ eject.exe / REMOVETHIS / SHOWEJECT
which will launch the USB Disk Ejector utility after unmounting the container.

Result: insert the USB flash drive, in the pop-up autorun window select "mount".
After entering the password for the protected section, Launchy is ready for work and can run all your portable programs.
After the end of the work, press Alt-Space, write eject - and you can pull out the flash drive (or umount to just unmount)

My scripts and necessary utilities are posted here . Glad questions and suggestions :)

Source: https://habr.com/ru/post/56804/


All Articles