DOS level test partition exists?

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 11518
Joined: 24 Jan 2010, 23:23
Location: paused.undefined.exposed

DOS level test partition exists?

Post by ChrisGreaves »

How to test for a partition?

Code: Select all

"C:\Program Files\TRUECrypt\TRUECrypt.exe" /q /lY  /v\Device\Harddisk2\Partition1
This line is from my BACKUP.BAT file.
It hooks drive Y: up to a USB 500GB drive which I have plugged into my laptop, and it works well.
Truecrypt pops up a password box and I key in the password.
Then back in my batch file I test:-

Code: Select all

if exist Y:\nul goto 20Backup
and carry on. Or not.

Is there an easy way, at the DOS command level, to test for the partition before essaying with TrueCrypt?
My current method requires me to take action ("Cancel") if I have not plugged in a drive (for whatever reason).
But if I could test existence of Harddisk2\Partition1 I could avoid wandering through TrueCrypt.

Thanks
Chris
We hate change, but love variety.

User avatar
StuartR
Administrator
Posts: 11060
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: DOS level test partition exists?

Post by StuartR »

Not in reply to your question Chris, but have you considered migrating from TrueCrypt to VeraCrypt

TrueCrypt is no longer supported, and is suspected to have been compromised.
VeraCrypt took the original OpenSource TrueCrypt code base and continued to develop and support it
StuartR


User avatar
ChrisGreaves
PlutoniumLounger
Posts: 11518
Joined: 24 Jan 2010, 23:23
Location: paused.undefined.exposed

Re: DOS level test partition exists?

Post by ChrisGreaves »

StuartR wrote:Not in reply to your question Chris, but have you considered migrating from TrueCrypt to VeraCrypt
Thanks Stuart.
I did try Veracrypt when it "came out" some five? years ago.
There was some sort of hiccup - it took too long or ... I forget what.
I am not overly worried about encryption; I need only enough to deter the opportunist thief. If the Feds want me, they know where to find me, and I will "sing" for four litres of ice-cream.

Back on thread(grin) I would have the same problem with any batch file that anticipates a USB drive, encrypted or not.
Or even a batch file that I want to run on a machine that had a different configuration.
For example, this Tecra is set up with one hard drive with two partitions (the second one encrypted).
Another laptop might have just the one partition.
My batch file could thus detect which system it was on and acto accordingly.

Cheers
Chris
Last edited by ChrisGreaves on 30 Jun 2020, 14:29, edited 1 time in total.
We hate change, but love variety.

User avatar
StuartR
Administrator
Posts: 11060
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: DOS level test partition exists?

Post by StuartR »

You could try running diskpart and parsing the output from commands like
LIST DISK
LIST VOLUME
SELECT DISK 0
LIST PARTITION
StuartR


User avatar
ChrisGreaves
PlutoniumLounger
Posts: 11518
Joined: 24 Jan 2010, 23:23
Location: paused.undefined.exposed

Re: DOS level test partition exists?

Post by ChrisGreaves »

StuartR wrote:SELECT DISK 0
Untitled.png
Thanks Stuart!
Chris
You do not have the required permissions to view the files attached to this post.
We hate change, but love variety.