Jump to content
LaunchBox Community Forums

PS3: Looking to Create a Batch file to Decrypt ISOs with PS3dec when launching a game. Then delete the decrypted PS3 file on QUIT.


darreldearth

Recommended Posts

5 minutes ago, JoeViking245 said:

The /d is needed to start that program from with it's folder.  

Try adding one more set of quotes (around %path2ps3dec%).

start "" /w /d "%path2ps3dec%" d key %key% "%encryptedISO%" "%decryptedISO%"

 

Thanks. Unfortunately the result was still the same. The system cannot find the file d.

image.thumb.png.8e02901b4cb6deaa7505213b4b6f321b.png

 

set path2ps3dec=C:\Users\darre\Desktop\TEMPPS3\PS3DEC\ps3dec.exe
set decryptedISO=C:\Users\darre\Desktop\TEMPPS3\DECRYPTED_GAMES\temp-decryptedGame.iso
set path2RPCS3ps1=M:\LaunchBox\Emulators\rpcs3\RPCS3-ISO-LaunchBox.ps1

set encryptedISO=%1
set keyFile=%~dpn1.dkey
set /p key=< "%keyFile%"


start "" /w /d "%path2ps3dec%" d key %key% "%encryptedISO%" "%decryptedISO%"
start "" /w "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -noprofile -executionpolicy bypass -WindowStyle hidden -file "%path2RPCS3ps1%" "%decryptedISO%"

del "%decryptedISO%

 

Edited by darreldearth
Link to comment
Share on other sites

Last ditch effort (ya, forgot one more thing 😊)

set path2ps3dec=C:\Users\darre\Desktop\TEMPPS3\PS3DEC\ps3dec.exe
set decryptedISO=C:\Users\darre\Desktop\TEMPPS3\DECRYPTED_GAMES\temp-decryptedGame.iso
set path2RPCS3ps1=M:\LaunchBox\Emulators\rpcs3\RPCS3-ISO-LaunchBox.ps1

set encryptedISO=%1
set keyFile=%~dpn1.dkey
set /p key=< "%keyFile%"
set path=%~dp1


start "" /w /d "%path%" "%path2ps3dec%" d key %key% "%encryptedISO%" "%decryptedISO%"
start "" /w "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -noprofile -executionpolicy bypass -WindowStyle hidden -file "%path2RPCS3ps1%" "%decryptedISO%"

del "%decryptedISO%

 

Link to comment
Share on other sites

14 minutes ago, JoeViking245 said:

Last ditch effort (ya, forgot one more thing 😊)

set path2ps3dec=C:\Users\darre\Desktop\TEMPPS3\PS3DEC\ps3dec.exe
set decryptedISO=C:\Users\darre\Desktop\TEMPPS3\DECRYPTED_GAMES\temp-decryptedGame.iso
set path2RPCS3ps1=M:\LaunchBox\Emulators\rpcs3\RPCS3-ISO-LaunchBox.ps1

set encryptedISO=%1
set keyFile=%~dpn1.dkey
set /p key=< "%keyFile%"
set path=%~dp1


start "" /w /d "%path%" "%path2ps3dec%" d key %key% "%encryptedISO%" "%decryptedISO%"
start "" /w "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -noprofile -executionpolicy bypass -WindowStyle hidden -file "%path2RPCS3ps1%" "%decryptedISO%"

del "%decryptedISO%

 

I appreciate you trying over and over. Seems like it got closer lol. this time it didnt have any errors, but it didnt decrypt the game so the emulator rpcs3 launched saying it couldnt find the game. The output of the CMD is below.

 

image.thumb.png.7713875024e138a8b5a29bfbc6e782eb.png

Link to comment
Share on other sites

5 hours ago, JoeViking245 said:

On the output for the command to decrypt-the-iso, it's putting 2 sets of double-quotes around the input iso file for some reason. 

image.thumb.png.a822f8ef83a9218550aaf38cc33b43c3.png

 

I guess remove the quotes (for that part) in the script and see what happens.?.?.  Seems odd, but worth a try

image.thumb.png.52563d612f7a2d8001ca4c583d7ead56.png

WOOT That Finally WORKED! Thanks! 

Now to see about trying to make a batch script using what you just made :) ill try doing what you posted before and see what happens lol. 

 

So for everyone else to see heres what finally ended up working (and like @JoeViking245 said only change the first 3 lines to fit your directories) (DKeys and Roms must be in same folder)....

 

Option 1: Here's @JoeViking245's magic batch code (Below) - which uses a .batch file in conjunction with @phunky1's RPCS3-ISO-Launchbox.ps1 script found here https://github.com/ptmorris1/RPCS3-ISOLauncher-Launchbox

set path2ps3dec=C:\Users\darre\Desktop\TEMPPS3\PS3DEC\ps3dec.exe
set decryptedISO=C:\Users\darre\Desktop\TEMPPS3\DECRYPTED_GAMES\temp-decryptedGame.iso
set path2RPCS3ps1=M:\LaunchBox\Emulators\rpcs3\RPCS3-ISO-LaunchBox.ps1

set encryptedISO=%1
set keyFile=%~dpn1.dkey
set /p key=< "%keyFile%"
set path=%~dp1


start "" /w /d "%path%" "%path2ps3dec%" d key %key% %encryptedISO% "%decryptedISO%"
start "" /w "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -noprofile -executionpolicy bypass -WindowStyle hidden -file "%path2RPCS3ps1%" "%decryptedISO%"

del "%decryptedISO%"

 

And of coarse Option 2!: the script @phunky1 made which is posted here: https://github.com/ptmorris1/RPCS3-ISOLauncher-Launchbox works great also and achived the same result. (Dkeys and Roms can be in seperate folders if specified if location is changed in the script). Use the RPCS3-Decrypt-ISO-LaunchBox.ps1 and not the regular RPCS3-ISO-Launchbox.ps1 listed above for his all in one ISO/decode Script. Download with instructions on his github link :) 

Also a link to his original post without decoding 

Edited by darreldearth
  • Like 1
  • Game On 1
Link to comment
Share on other sites

Glad it's [finally] working.  :D You should now be able to create a new emulator in LB as was originally discussed/shown way back when, using this batch file.

 

As for the bulk decrypt batch file, now that things are all ironed out it can be fixed too. (if you decide to use it)

@echo off
set path2ps3dec=D:\PS3\utilities\ps3dec\ps3dec.exe
set decryptedISOFolder=D:\temp\decryptedISOs\

for %%f in (*.iso) do (
  set keyFile=%%~dpnf.dkey
  set /p key=< "%keyFile%"
  %path2ps3dec% d key %key% "%%f" "%decryptedISOFolder%%%f"
)

pause

🤞

Link to comment
Share on other sites

6 minutes ago, JoeViking245 said:

Glad it's [finally] working.  :D You should now be able to create a new emulator in LB as was originally discussed/shown way back when, using this batch file.

 

As for the bulk decrypt batch file, now that things are all ironed out it can be fixed too. (if you decide to use it)

@echo off
set path2ps3dec=D:\PS3\utilities\ps3dec\ps3dec.exe
set decryptedISOFolder=D:\temp\decryptedISOs\

for %%f in (*.iso) do (
  set keyFile=%%~dpnf.dkey
  set /p key=< "%keyFile%"
  %path2ps3dec% d key %key% "%%f" "%decryptedISOFolder%%%f"
)

pause

🤞

Yeah it worked great! Thanks :) for the batch file i gave it a try only changing folder locations and this was the result

image.thumb.png.cff6bd3bd20513d5c9fa158e69ee4566.png 

@echo off
set path2ps3dec=C:\Users\darre\Desktop\TEMPPS3\PS3DEC\ps3dec.exe
set decryptedISOFolder=C:\Users\darre\Desktop\TEMPPS3\DECRYPTED_GAMES\

for %%f in (*.iso) do (
  set keyFile=%%~dpnf.dkey
  set /p key=< "%keyFile%"
  %path2ps3dec% d key %key% "%%f" "%decryptedISOFolder%%%f"
)

pause

 

Link to comment
Share on other sites

1 hour ago, JoeViking245 said:

Change the one line to look like (add echo in front of it). Then look at the full command line(s) that would have been executed.

echo %path2ps3dec% d key %key% "%%f" "%decryptedISOFolder%%%f"

I'm assuming your testing this in a folder with just 2 iso files (and their dkey files) and not ALL of them. ;) 

 

this was the output from adding echo. nothing was decrypted. just asks you to press any key to continue and then the window closes. lol and yeah im only testing with 2 files in a folder on my desktop for now haha

image.thumb.png.2a714bc62cb0341c2f8c2ff5b6af279a.png

Edited by darreldearth
Link to comment
Share on other sites

@echo off
set path2ps3dec=C:\Users\darre\Desktop\TEMPPS3\PS3DEC\ps3dec.exe
set decryptedISOFolder=C:\Users\darre\Desktop\TEMPPS3\DECRYPTED_GAMES\
set path=C:\Users\darre\Desktop\TEMPPS3\PS3DEC\

for %%f in (*.iso) do (
  set keyFile=%%~dpnf.dkey
  set /p key=< "%keyFile%"
  start "" /w /d "%path%" %path2ps3dec% d key %key% "%%f" "%decryptedISOFolder%%%f"
)

pause

Another last ditch effort. lol 

Wait... the lon-gass key wasn't showing in your last image.  Do you have the dkey files in with the iso's you're decrypting?  So the one batch file, 2 .iso files and 2 .dkey files?

Link to comment
Share on other sites

19 minutes ago, JoeViking245 said:
@echo off
set path2ps3dec=C:\Users\darre\Desktop\TEMPPS3\PS3DEC\ps3dec.exe
set decryptedISOFolder=C:\Users\darre\Desktop\TEMPPS3\DECRYPTED_GAMES\
set path=C:\Users\darre\Desktop\TEMPPS3\PS3DEC\

for %%f in (*.iso) do (
  set keyFile=%%~dpnf.dkey
  set /p key=< "%keyFile%"
  start "" /w /d "%path%" %path2ps3dec% d key %key% "%%f" "%decryptedISOFolder%%%f"
)

pause

Another last ditch effort. lol 

Wait... the lon-gass key wasn't showing in your last image.  Do you have the dkey files in with the iso's you're decrypting?  So the one batch file, 2 .iso files and 2 .dkey files?

 

Ugh didnt work lol. But Yeah they're all in the same folder like in the screenshot below....

image.png.368c6926e97acd37034c97b42fb7c80c.png

 

The new line of code just gave this result...

image.png.fb3d1c48cf0aa6e2e7542e429a3d0a93.png

 

Link to comment
Share on other sites

Here is a Powershell that should work.  Change the first 4 variables paths to suit your needs....$PS3DEC,$ISOroot,$ISOdecrypt,$dkeys.  Then save to .ps1 file and run.

 

#path to ps3dec.exe
$PS3DEC = 'C:\path\ps3dec.exe'

#root folder where you keep encrypted iso
$ISOroot = 'C:\MYisos'

#root folder where decrypted ISO will be stored.
$ISOdecrypt = 'C:\decrypted'

#root folder you keep all dkeys files
$dKeys = 'C:\keys'

$ISOall = Get-ChildItem $ISOroot
$report = foreach ($iso in $ISOall) {
    Clear-Variable key -ErrorAction SilentlyContinue
    $Key = Get-ChildItem $dKeys | Where-Object -Property name -Like "$([System.IO.Path]::GetFileNameWithoutExtension($iso.fullname))*"
    if ($null -ne $key){
        $KeyValue = Get-Content $key.FullName
        $DecryptISO = $ISOdecrypt + "$([System.IO.Path]::GetFileNameWithoutExtension($iso.fullname))" + '_DEC.iso'
        & $PS3DEC d key $KeyValue $($iso.fullname) $DecryptISO
        [PSCustomObject]@{
            OrginalISO = $iso.name
            Decrypted = $DecryptISO
            Status = 'Completed'
        }
    } else {
        [PSCustomObject]@{
            OrginalISO = $iso.name
            Decrypted  = ''
            Status     = 'No Key found'
        }
    }
}

$report

 

Edited by phunky1
Error in script
Link to comment
Share on other sites

Here's my updated batch file.

@phunky1's PS script will probably work right from the get-go, but I'm bound and determined to get mine to work on at least your 2 test files. lol

@echo off
set path2ps3dec=C:\Users\darre\Desktop\TEMPPS3\PS3DEC\ps3dec.exe
set decryptedISOFolder=C:\Users\darre\Desktop\TEMPPS3\DECRYPTED_GAMES\
set path=C:\Users\darre\Desktop\TEMPPS3\PS3DEC\

setlocal EnableDelayedExpansion
Set key=

for %%f in (*.iso) do (
  set keyFile=%%~dpnf.dkey
  set /p key=< "!keyFile!"
  start "" /w /d "%path%" %path2ps3dec% d key !key! "%%~dpnxf" "%decryptedISOFolder%%%f"
)

pause

 

  • Like 1
Link to comment
Share on other sites

2 hours ago, JoeViking245 said:

Here's my updated batch file.

@phunky1's PS script will probably work right from the get-go, but I'm bound and determined to get mine to work on at least your 2 test files. lol

@echo off
set path2ps3dec=C:\Users\darre\Desktop\TEMPPS3\PS3DEC\ps3dec.exe
set decryptedISOFolder=C:\Users\darre\Desktop\TEMPPS3\DECRYPTED_GAMES\
set path=C:\Users\darre\Desktop\TEMPPS3\PS3DEC\

setlocal EnableDelayedExpansion
Set key=

for %%f in (*.iso) do (
  set keyFile=%%~dpnf.dkey
  set /p key=< "!keyFile!"
  start "" /w /d "%path%" %path2ps3dec% d key !key! "%%~dpnxf" "%decryptedISOFolder%%%f"
)

pause

 

haha. Gave it shot but it didnt work. here's what it said without the ECHO 

image.thumb.png.d1e9eb1c708268923a677d52b0492179.png

 

 

also tried the older version without echo just to be sure 😁


set path2ps3dec=C:\Users\darre\Desktop\TEMPPS3\PS3DEC\ps3dec.exe
set decryptedISOFolder=C:\Users\darre\Desktop\TEMPPS3\DECRYPTED_GAMES\

for %%f in (*.iso) do (
  set keyFile=%%~dpnf.dkey
  set /p key=< "%keyFile%"
  %path2ps3dec% d key %key% "%%f" "%decryptedISOFolder%%%f"
)

pause

image.thumb.png.e4693a1982fc2b284d64229c948909e3.png

 

 

Link to comment
Share on other sites

5 hours ago, phunky1 said:

Here is a Powershell that should work.  Change the first 4 variables paths to suit your needs....$PS3DEC,$ISOroot,$ISOdecrypt,$dkeys.  Then save to .ps1 file and run.

 

#path to ps3dec.exe
$PS3DEC = 'C:\path\ps3dec.exe'

#root folder where you keep encrypted iso
$ISOroot = 'C:\MYisos'

#root folder where decrypted ISO will be stored.
$ISOdecrypt = 'C:\decrypted'

#root folder you keep all dkeys files
$dKeys = 'C:\keys'

$ISOall = Get-ChildItem $ISOroot
$report = foreach ($iso in $ISOall) {
    Clear-Variable key -ErrorAction SilentlyContinue
    $Key = Get-ChildItem $dKeys | Where-Object -Property name -Like "$([System.IO.Path]::GetFileNameWithoutExtension($iso.fullname))*"
    if ($null -ne $key){
        $KeyValue = Get-Content $key.FullName
        $DecryptISO = $ISOdecrypt + "\$([System.IO.Path]::GetFileNameWithoutExtension($iso.fullname))" + '_DEC.iso'
        & $PS3DEC d key $KeyValue $($iso.fullname) $DecryptISO
        [PSCustomObject]@{
            OrginalISO = $iso.name
            Decrypted = $DecryptISO
            Status = 'Completed'
        }
    } else {
        [PSCustomObject]@{
            OrginalISO = $iso.name
            Decrypted  = ''
            Status     = 'No Key found'
        }
    }
}

$report

 

I tried your code before I ran out of the house this morning, so I didnt have much time to troubleshoot😵, but after changing the paths and running the script the powershell window would open and immediately close without doing anything. I'll mess with it a bit more in a couple hours once I get back and see if I can figure out why that is and let you know. Thanks!

Link to comment
Share on other sites

35 minutes ago, darreldearth said:

I tried your code before I ran out of the house this morning, so I didnt have much time to troubleshoot😵, but after changing the paths and running the script the powershell window would open and immediately close without doing anything. I'll mess with it a bit more in a couple hours once I get back and see if I can figure out why that is and let you know. Thanks!

No problem, I did find a typo just now and updated the post.  That maybe the issue as it was a bad path.

 

Just fixed a few issues and actually tested it.  Has some verbose details now so hopefully good to go.  https://github.com/ptmorris1/RPCS3-ISOLauncher-Launchbox/blob/master/Bulk-Decrypt-ISOs.ps1

Edited by phunky1
fixed script and added link;grammar
Link to comment
Share on other sites

1 hour ago, phunky1 said:

No problem, I did find a typo just now and updated the post.  That maybe the issue as it was a bad path.

 

Just fixed a few issues and actually tested it.  Has some verbose details now so hopefully good to go.  https://github.com/ptmorris1/RPCS3-ISOLauncher-Launchbox/blob/master/Bulk-Decrypt-ISOs.ps1

hmmm... tried the new code but the same thing is happening with windowspowershell. The window launches and imediately closes. below is the code i used with my paths replacing the original ones. is there a way to pause the script at the end so the window will stay open so i can read/post what is says? i tried adding -noexit and also tried adding Read-Host -Prompt "Press Enter to exit" to the end of the script but it didnt keep the window from forcing closed 

#path to ps3dec.exe
$PS3DEC = 'C:\Users\darre\Desktop\TEMPPS3\PS3DEC\ps3dec.exe'

#root folder where you keep encrypted iso
$ISOroot = 'C:\Users\darre\Desktop\TEMPPS3'

#root folder where decrypted ISO will be stored.
$ISOdecrypt = 'C:\Users\darre\Desktop\TEMPPS3\DecryptedGames'

#root folder you keep all dkeys files
$dKeys = 'C:\Users\darre\Desktop\TEMPPS3\Keys'

$ISOall = Get-ChildItem -LiteralPath $ISOroot
$report = foreach ($iso in $ISOall) {
    [int]$currentItem = [array]::indexof($ISOall, $iso)
    Write-Progress -Activity 'Decrypting isos....' -Status "Currently Decrypting - $($iso.name) - $($currentItem) of $($ISOall.Count - 1) $([math]::round((($currentItem + 1)/$ISOall.Count),2) * 100)% " -PercentComplete $([float](($currentItem + 1) / $ISOall.Count) * 100)
    Clear-Variable key -ErrorAction SilentlyContinue
    $Key = Get-ChildItem -LiteralPath $dKeys | Where-Object -Property name -Like "$([System.IO.Path]::GetFileNameWithoutExtension($iso.fullname))*"
    if ($null -ne $key){
        Write-Host "Decrypting... $($iso.name)" -ForegroundColor Green
        $KeyValue = Get-Content -LiteralPath $key.FullName
        $DecryptISO = $ISOdecrypt + "\$([System.IO.Path]::GetFileNameWithoutExtension($iso.fullname))" + '_DEC.iso'
        & $PS3DEC d key $KeyValue $($iso.fullname) $DecryptISO
        [PSCustomObject]@{
            OrginalISO = $iso.name
            Decrypted = $DecryptISO
            Status = 'Completed'
        }
    } else {
        Write-Host "No key found for $($iso.name)" -ForegroundColor Red
        [PSCustomObject]@{
            OrginalISO = $iso.name
            Decrypted  = ''
            Status     = 'No Key found'
        }
    }
}

$report

 

Link to comment
Share on other sites

12 minutes ago, darreldearth said:

hmmm... tried the new code but the same thing is happening with windowspowershell. The window launches and imediately closes. below is the code i used with my paths replacing the original ones. is there a way to pause the script at the end so the window will stay open so i can read/post what is says? i tried adding -noexit and also tried adding Read-Host -Prompt "Press Enter to exit" to the end of the script but it didnt keep the window from forcing closed 

You downloaded the script from link right?

It maybe windowsPowershell issues, but open powershell and run script from the prompt like C:\path\myscript.ps1 or path into location of script and do .\script.ps1

 

Oh and maybe your execution policy.  run this as well:   Set-ExecutionPolicy RemoteSigned -force

Edited by phunky1
Set-ExecutionPolicy RemoteSigned -force
  • Like 1
Link to comment
Share on other sites

🥳🥳@JoeViking245 Got his code working for bulk Decrypting!

This is the code he made below which worked😁

As he was saying just replace your paths in the first 3 rows Listed below....

1: ps3dec.exe decoder program (.exe) location

2: Folder Location for your new decrypted games

3: path to location of your Batch file & Encrypted roms which will be decrypted

@echo off
set path2ps3dec=C:\Users\darre\Desktop\TEMPPS3\PS3DEC\ps3dec.exe
set decryptedISOFolder=C:\Users\darre\Desktop\TEMPPS3\DECRYPTED_GAMES\
set path=C:\Users\darre\Desktop\TEMPPS3\PS3DEC\

setlocal EnableDelayedExpansion
Set key=

for %%f in (*.iso) do (
  set keyFile=%%~dpnf.dkey
  set /p key=< "!keyFile!"

  echo key file: !keyFile!
  echo key=:     !key!

  start "" /w /d "%path%" "%path2ps3dec%" d key !key! "%%~dpnxf" "%decryptedISOFolder%%%f"
)
pause

🥳

  • Game On 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...