# PowerShellでバッチファイルを作成
$batFilePath = "C:\RPA\TVScripts\OpenTV.bat"

# バッチファイルに書き込む内容
$batContent = @"
@echo off
powershell -ExecutionPolicy Bypass -NoProfile -Command "Start-Process -FilePath 'C:\Program Files\TeamViewer\TeamViewer.exe' -ArgumentList '--gui'"
"@

# フォルダが存在しない場合は作成
$folder = Split-Path $batFilePath
if (-not (Test-Path $folder)) {
    New-Item -Path $folder -ItemType Directory -Force
}

# 内容を書き込み
Set-Content -Path $batFilePath -Value $batContent -Encoding UTF8

Write-Output "バッチファイルが作成されました: $batFilePath"

目次