$ErrorActionPreference = "Stop" Write-Host "Alpnexa Drive Client for Windows" Write-Host "The token will be stored in your local rclone config or Windows WebDAV mapping. Revoke the token if this machine is shared, lost, or retired." $Token = Read-Host "Folder token" if ([string]::IsNullOrWhiteSpace($Token)) { throw "Missing token." } $DriveLetter = Read-Host "Drive letter [X]" if ([string]::IsNullOrWhiteSpace($DriveLetter)) { $DriveLetter = "X" } $DriveLetter = $DriveLetter.TrimEnd(":") $Url = "https://downloads.alpnexa.com/dav/$Token/" $RemoteName = "alpnexa_filedrive" if (Get-Command rclone -ErrorAction SilentlyContinue) { rclone config create $RemoteName webdav url $Url vendor other | Out-Null Start-Process -WindowStyle Hidden -FilePath "rclone" -ArgumentList @("mount", "$RemoteName`:", "$DriveLetter`:", "--vfs-cache-mode", "writes", "--network-mode") } else { Write-Host "rclone not found; using Windows WebDAV redirector. Native WebDAV is a basic fallback; rclone plus WinFsp is recommended for regular upload/download work." cmd /c "net use $DriveLetter`: `"$Url`" /persistent:yes" } $ShortcutPath = Join-Path ([Environment]::GetFolderPath("Desktop")) "Alpnexa Drive.lnk" $Shell = New-Object -ComObject WScript.Shell $Shortcut = $Shell.CreateShortcut($ShortcutPath) $Shortcut.TargetPath = "$DriveLetter`:\" $Shortcut.IconLocation = "shell32.dll,9" $Shortcut.Save() Write-Host "Drive available at $DriveLetter`:\" Write-Host "Desktop shortcut: $ShortcutPath"