准备powershell脚本
 2. regedit的路径是:计算机\HKEY_CLASSES_ROOT\Directory\shell\,在此项目下新增子项目diy_command\command,command的数据值为powershell D:\windowsProjects\directory_diy.ps1 %1
 
- 效果,点击后进入和powershell的交互。
  
powershell脚本:
$path_strs = $args[0] -split "\\"
$dir=$path_strs -join "\\"
$dir_name =$path_strs[$path_strs.Length - 1]
$userInput = Read-Host "请输入压缩密码并按回车键"
if ($userInput -eq "") {
    Start-Process "C:\\allUserApplication\\portableApp\\PortableApps\\7-ZipPortable\\App\\7-Zip64\\7z.exe"  -ArgumentList "a", "C:\\Users\\mammon\\Desktop\\$dir_name\\$dir_name.zip", "$dir\\*" -Wait
} else {
    Write-Host "your pass is $userInput" -ForegroundColor Yellow -BackgroundColor Blue
    Start-Process "C:\\allUserApplication\\portableApp\\PortableApps\\7-ZipPortable\\App\\7-Zip64\\7z.exe"  -ArgumentList "a", "$dir\\$dir_name.zip", "$dir\\*" ,"-p$userInput" -Wait
}
# 阻塞一段时间(例如3秒)
Start-Sleep -Seconds 3













![[卫星遥感] 解密卫星目标跟踪:挑战与突破的深度剖析](https://i-blog.csdnimg.cn/direct/87787d6d2658497cbda48e8741f1381a.png)




