For the past week or so I'm trying out a new way to "deploy" a folder to another computer's desktop, download a couple of files in it and then run one of them as admin. The only thing is the file that does all this needs to be really lightweight, like under 500KB or so, or else it's useless.

The problem with this approach is the fact that, once it starts the downloaded File1.bat, that file asks for admin rights and once I click "yes" it just opens up another command prompt which asks for admin rights and that happens over and over again, like in a continuous loop. If I do not ask for admin rights the file works just as intended. So I'm guessing it's either a problem with how I'm asking for admin permissions or how it acts regarding the fact that it's a SFX archive or it might be something else entirely.

Do you guys have any idea how to make this work and as space-efficient as possible? I'm open to any idea whatsoever like changing how I download files, how I ask for admin rights, how not to use a SFX archive but something else etc

Note: I'm only using winhttpjs because of the really small file size (20KB) compared to popular alternatives like wget or curl and I'm only using it to download a couple of .bat files from Google Drive, one of it being itself (I'm using it to also download more files later in the script, but that's irrelevant). If I could somehow download the files directly from the run.bat file without needing to call on winhttpjs, or if I could modify the winhttpjs to also download the 3 files so I could skip the run.bat altogether that would be great (unfortunately BITS is slow and deprecated).

Why not use PowerShell? A simple Invoke-WebRequest could be sufficient?
– SethMay 31 '17 at 11:44

Powershell is not available on XP, Vista, Windows 7
– Claudiu DraganMay 31 '17 at 11:46

1

Powershell 1 and are supported by Vista. Your approach is likely to be detected as win32-generic-downloader and blocked by most antiviruses.
– OvermindMay 31 '17 at 11:48

I am able to get it digitally signed so that is not an issue. I will explore the possibility of using PowerShell (didn't know it was available on older OSs than Win8 - fail on my part) but I really want total compatibility for this, I'm not sure if PowerShell if the way to go.
– Claudiu DraganMay 31 '17 at 15:12

I suggest using wget, the PowerShell approach that is possible, that does what you want, doesn't work with version of Powershell your using on Windows XP and Windows Vista
– RamhoundMay 31 '17 at 15:17