I want to decrypt a file that is AES encryptet, with a script on powershell. To decrypt it I want to use a openSSL binary, that the script automatically downloads. When I execute the openssl.exe with start-Process -FilePath "$pwd\openssl\openssl.exe"
a new cmd-window opens and I can enter my command to decrypt the file there. (which works I have tested it) So my question: Is there a way to execute the command openssl aes-256-cbc -d -a -in secrets.txt.enc -out secrets.txt.new
with the.exe without having to manually input it into the new window?
Yes, try this:
& ".\openssl\openssl.exe" aes-256-cbc -d -a -in secrets.txt.enc -out secrets.txt.new
Using Start-Process
, you can pass the parameters with -ArgumentList
:
Start-Process -FilePath "$pwd\openssl\openssl.exe" -ArgumentList "aes-256-cbc -d -a -in secrets.txt.enc -out secrets.txt.new"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.