# 尝试读取 Excel 文件的简单方案 # 由于没有安装 Excel 读取库,使用 PowerShell 和其他方式 $envPath = "c:\work\data\env.xlsx" Write-Output "Excel 文件路径: $envPath" Write-Output "文件大小: $(Get-Item $envPath).Length bytes" Write-Output "创建时间: $(Get-Item $envPath).LastWriteTime" Write-Output "" # 尝试作为二进制读取并查找文本 $bytes = [System.IO.File]::ReadAllBytes($envPath) # 查找可能的 Git URL 或 GitHub 相关关键词 $text = [System.Text.Encoding]::UTF8.GetString($bytes) $gitKeywords = @("git", "github", "repository", "repo", "git@", "https://", ".git", "ssh", "clone") $foundKeywords = @() foreach ($keyword in $gitKeywords) { if ($text -like "*$keyword*") { $foundKeywords += $keyword } } Write-Output "找到的 Git 相关关键词: $($foundKeywords -join ', ')" # 尝试查找 URL 模式 $urls = [regex]::Matches($text, "https?://github\.com/[^\s`"]+") Write-Output "`n找到的 URLs:" if ($urls.Count -gt 0) { $urls | ForEach-Object { Write-Output " - $_.Value" } } else { Write-Output " 未找到 https://github.com/ 格式的 URL" } # 读取前 2000 个字符查看内容 Write-Output "`n文件前 2000 个字符:" Write-Output $text.Substring(0, [Math]::Min(2000, $text.Length)))