基于Windows PowerShell语言开发,使用gpt-4o写的代码,使用Invoke-PS2EXE工具打包,未签名未混淆,可自行解包DIY,后附代码。
本人非码农,业余选手,首次发帖,大神嘴下留德,不喜勿喷。
如果您愿意赞赏,我将不胜感激!
百度网盘下载地址见附件
超级批量复制工具下载链接.txt
(140 Bytes, 下载次数: 1)
2024-12-5 16:50 上传
点击文件名下载附件
下载积分: 吾爱币 -1 CB
使用步骤:
1、双击运行“超级批量复制工具.exe”工具;
2、点击“选择原始文件夹”,选择要复制的文件所在文件夹,可选择父目录,工具会自动查找子目录内容;
3、点击“导入文件名”,选择要导入的文件名所在文件,支持txt和CVS格式,文件名每条一行,
[color=]需包含尾缀
;
4、点击“目标文件夹”,选择要把复制的文件保存的位置;
5、点击“开始复制”,即开始根据文件名搜索文件,匹配后将文件复制到指定文件夹,复制完成后弹窗提示。
1.png (12.95 KB, 下载次数: 0)
下载附件
2024-12-5 16:50 上传
2.png (13.74 KB, 下载次数: 0)
下载附件
2024-12-5 16:50 上传
3.png (19.06 KB, 下载次数: 0)
下载附件
2024-12-5 16:50 上传
附powershell代码:
[PowerShell] 纯文本查看 复制代码Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
# Create the main form
$form = New-Object System.Windows.Forms.Form
$form.Text = "超级批量复制工具 by JamesChan V1.1"
$form.Size = New-Object System.Drawing.Size(420, 300)
$form.StartPosition = "CenterScreen"
# Initialize paths
$global:sourcePath = ""
$global:fileListPath = ""
$global:targetPath = ""
# Source folder button
$sourceButton = New-Object System.Windows.Forms.Button
$sourceButton.Location = New-Object System.Drawing.Point(10, 10)
$sourceButton.Size = New-Object System.Drawing.Size(120, 30)
$sourceButton.Text = "选择原始文件夹"
$form.Controls.Add($sourceButton)
$sourceTextBox = New-Object System.Windows.Forms.TextBox
$sourceTextBox.Location = New-Object System.Drawing.Point(140, 15)
$sourceTextBox.Size = New-Object System.Drawing.Size(250, 20)
$sourceTextBox.ReadOnly = $true
$form.Controls.Add($sourceTextBox)
$sourceButton.Add_Click({
$folderBrowser = New-Object System.Windows.Forms.FolderBrowserDialog
if ($folderBrowser.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) {
$global:sourcePath = $folderBrowser.SelectedPath
$sourceTextBox.Text = $global:sourcePath
}
})
# File list button
$fileListButton = New-Object System.Windows.Forms.Button
$fileListButton.Location = New-Object System.Drawing.Point(10, 50)
$fileListButton.Size = New-Object System.Drawing.Size(120, 30)
$fileListButton.Text = "导入文件名"
$form.Controls.Add($fileListButton)
$fileListTextBox = New-Object System.Windows.Forms.TextBox
$fileListTextBox.Location = New-Object System.Drawing.Point(140, 55)
$fileListTextBox.Size = New-Object System.Drawing.Size(250, 20)
$fileListTextBox.ReadOnly = $true
$form.Controls.Add($fileListTextBox)
$fileListButton.Add_Click({
$fileBrowser = New-Object System.Windows.Forms.OpenFileDialog
$fileBrowser.Filter = "Text and CSV Files (*.txt;*.csv)|*.txt;*.csv"
if ($fileBrowser.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) {
$global:fileListPath = $fileBrowser.FileName
$fileListTextBox.Text = $global:fileListPath
}
})
# Target folder button
$targetButton = New-Object System.Windows.Forms.Button
$targetButton.Location = New-Object System.Drawing.Point(10, 90)
$targetButton.Size = New-Object System.Drawing.Size(120, 30)
$targetButton.Text = "目标文件夹"
$form.Controls.Add($targetButton)
$targetTextBox = New-Object System.Windows.Forms.TextBox
$targetTextBox.Location = New-Object System.Drawing.Point(140, 95)
$targetTextBox.Size = New-Object System.Drawing.Size(250, 20)
$targetTextBox.ReadOnly = $true
$form.Controls.Add($targetTextBox)
$targetButton.Add_Click({
$folderBrowser = New-Object System.Windows.Forms.FolderBrowserDialog
if ($folderBrowser.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) {
$global:targetPath = $folderBrowser.SelectedPath
$targetTextBox.Text = $global:targetPath
}
})
# Start copying button
$copyButton = New-Object System.Windows.Forms.Button
$copyButton.Location = New-Object System.Drawing.Point(10, 130)
$copyButton.Size = New-Object System.Drawing.Size(120, 30)
$copyButton.Text = "开始复制"
$form.Controls.Add($copyButton)
$copyButton.Add_Click({
if (-not $global:sourcePath -or -not $global:fileListPath -or -not $global:targetPath) {
[System.Windows.Forms.MessageBox]::Show("请先选择必需的路径和文件。", "错误")
return
}
# Read the file names from the list
$fileNames = Get-Content -Path $global:fileListPath -Encoding UTF8 | Where-Object { $_.Trim() -ne "" }
if (-not $fileNames) {
[System.Windows.Forms.MessageBox]::Show("文件名列表为空或无有效条目。", "错误")
return
}
# Ensure target directory exists
if (-not (Test-Path $global:targetPath)) {
New-Item -ItemType Directory -Path $global:targetPath | Out-Null
}
# Copy files
foreach ($fileName in $fileNames) {
$fileName = $fileName.Trim()
$files = Get-ChildItem -Path $global:sourcePath -Recurse -File | Where-Object { $_.Name -eq $fileName }
if ($files) {
foreach ($file in $files) {
$destFile = Join-Path -Path $global:targetPath -ChildPath $file.Name
Copy-Item -Path $file.FullName -Destination $destFile -Force
}
}
}
[System.Windows.Forms.MessageBox]::Show("文件复制完成!")
})
# Show the form
$form.Add_Shown({ $form.Activate() })
[void]$form.ShowDialog()