24 lines
875 B
PowerShell
24 lines
875 B
PowerShell
# Launch Google Drive for Desktop
|
|
$logFile = "%TEMP%\googledrive-launch.log"
|
|
|
|
# Check if Google Drive File Stream is already set to launch on startup
|
|
$startupKey = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
|
|
$driveKey = "GoogleDriveFS"
|
|
|
|
try {
|
|
$existingValue = Get-ItemProperty -Path $startupKey -Name $driveKey -ErrorAction Stop
|
|
Add-Content -Path $logFile -Value "Google Drive File Stream is already set to launch on startup."
|
|
}
|
|
catch {
|
|
# Key doesn't exist, so launch Google Drive
|
|
Add-Content -Path $logFile -Value "Launching Google Drive for Desktop..."
|
|
|
|
# Path to Google Drive launch executable
|
|
$driveLaunchPath = "C:\Program Files\Google\Drive File Stream\launch.bat"
|
|
|
|
# Start Google Drive
|
|
Start-Process -FilePath $driveLaunchPath -WindowStyle Hidden
|
|
|
|
# Wait for Google Drive to launch
|
|
Start-Sleep -Seconds 5
|
|
} |