Page 1 of 1

Encrypt files in folder

Posted: Thu Mar 01, 2018 9:12 pm
by bstahl5012
I'm a newby with AES Crypt....
Is is it possible and/or how would I Encrypt all files in a Folder?
And Can it be done with PowerShell or would I use a Batch?

Re: Encrypt files in folder

Posted: Fri Mar 02, 2018 2:08 pm
by paulej
AES Crypt is intended to encrypt files and will not traverse directories. However, you can select all files in a folder, right-click, and select AES Encrypt to encrypt all of them using the same password. You can also search a folder for files and encrypt all of them you select.

There is a command-line tool called "aescrypt.exe" in C:\Program Files\AESCrpyt that can be used with a batch file or PowerShell script. However, you'd have to write that script, as I don't have one.

Re: Encrypt files in folder

Posted: Mon Mar 05, 2018 3:31 pm
by bstahl5012
Thanks for the reply. We are only going to use the Command Line function of AES Crypt since it is part of a process...

So using PowerShell do you mean something like this?

ForEach-Object {

$app = 'C:\Program Files\AESCrypt_console_v310_x64\aescrypt.exe'
$arg1 = '-e'
$arg2 = '-p password'
$arg3 = 'C:\<path to stuff to be encrypted>\Outbound_ENCRYPT\*'

& $app $arg1 $arg2 $arg3}

This works but I'm having a problem replacing "password" with a variable that I'm piping from a Password generator...
Any ideas?

Re: Encrypt files in folder

Posted: Mon Mar 05, 2018 8:55 pm
by paulej
Yeah, that's the idea. You could also have the encrypted file placed elsewhere using the -o flag.

I'm not a PowerShell user myself, so I can't suggest how to pass in the password. I assume you could somehow pass it as either an environment variable or as an argument to the script. I could do either of those things with a batch file, so no doubt PowerShell is equally capable of doing either.

Re: Encrypt files in folder

Posted: Thu Mar 08, 2018 1:59 pm
by bstahl5012
to pass the password as a variable using Argument in PowerShell to AES this worked...

$arg2 = "-p $CryptPass"