我有点卡住了。我正在尝试创建一个脚本来提取压缩的 ISO 文件并在模拟器上播放它们。我已经做到了这一点:
param (
[string]$7zPath, # File location of 7z
[string]$emulatorPath, # File location of the Emulator exe
[string]$filePath # File location of the compressed file
)
$7zArgList = @(
"e", # 7z arguments go here
$filePath
)
# Location of the decompressed game <<< This is what is incorrect!!!
$decompressedFile = $filePath.Substring(0, $filePath.LastIndexOf("."))
# Start 7z and print the output in the console
"Starting decompression using 7z"
& $7zPath $7zArgList | Out-Host
# Start Emulator
"Starting Emulator"
Start-Process $emulatorPath -ArgumentList """$decompressedFile""" -Wait
# Remove the decompressed file when Emulator closes
"Removing the decompressed file"
Remove-Item $decompressedFile
"Done"
所以我开始游戏的命令(在将此 .ps1 转换为 .exe 之后)将类似于:
"ThisCode.exe" "7zip.exe" "Emulator.exe" "Path2Rom"
所以例如
"C:\7zPrepper.exe" "C:\Program Files\7-Zip\7z.exe" "C:\Program Files (x86)\PCSX2\pcsx2.exe" "C:\Roms\Game 1.7z"
我已经确定了我需要在哪里修改我的脚本以使其在正确的位置查找我提取的文件...未压缩文件的文件名始终与存档名称相同,但扩展名为 .ISO 或 .BIN . 理想情况下,我希望脚本首先检查 .ISO,如果找不到,请检查 .BIN,但我们的知识水平已经超出了我的水平......非常感谢任何帮助!