PROGRAMAR HTML_JS_pesquisar BAIDU---sair
# Função para pesquisar no Baidu
Write-Host "Por favor, insira um termo de pesquisa." -ForegroundColor Red
$EncodedQuery = [uri]::EscapeDataString($Query)
$BaiduURL = "https://www.baidu.com/s?wd=$EncodedQuery"
Start-Process "msedge.exe" -ArgumentList $BaiduURL # Substitua "msedge.exe" por "chrome.exe" ou outro navegador, se preferir
# Função para abrir arquivos HTML ou JavaScript
if (-not (Test-Path $FilePath)) {
Write-Host "Arquivo não encontrado: $FilePath" -ForegroundColor Red
Start-Process "msedge.exe" -ArgumentList $FilePath # Substitua "msedge.exe" pelo navegador de sua preferência
# Execução direta sem menu
if ($args.Length -gt 0) {
if ($args.Length -lt 2) {
Write-Host "Uso: script.ps1 search <termo de pesquisa>" -ForegroundColor Yellow
$SearchTerm = $args[1..$args.Length] -join " "
Search-Baidu -Query $SearchTerm
if ($args.Length -ne 2) {
Write-Host "Uso: script.ps1 open <caminho do arquivo HTML/JavaScript>" -ForegroundColor Yellow
Open-HTML-JS -FilePath $args[1]
Write-Host "Comando inválido. Use 'search' ou 'open'." -ForegroundColor Red
# Menu interativo, apenas se não houver argumentos
Write-Host "===== Menu Principal =====" -ForegroundColor Cyan
Write-Host "1. Pesquisar no Baidu"
Write-Host "2. Abrir arquivo HTML/JavaScript"
$Choice = Read-Host "Escolha uma opção (1-3)"
$SearchTerm = Read-Host "Digite o termo de pesquisa"
Search-Baidu -Query $SearchTerm
$FilePath = Read-Host "Digite o caminho completo do arquivo HTML/JavaScript"
Open-HTML-JS -FilePath $FilePath
Write-Host "Saindo..." -ForegroundColor Green
Write-Host "Opção inválida. Tente novamente." -ForegroundColor Yellow
# Executar o menu principal