Hi @BAU , I was reading the powershell scripting from your snippet and thanks to all the contents I've learned much. Here may I ask a question: Is there a way to achieve both of the 2 purposes at the same time in one hybrid batch/powershell script: 1. auto elevate admin privilege (and if failed output error msg, avoid infinite looping) 2. pass all argvs from outside the script (e.g. test.bat argv1 "argv 2" \argv:3) Thank you very much!
Check this out: Code: @echo off :::: Run as administrator AveYo: no ps\vbs so no av delay, proper parameters pass, loop guard set "S=%systemroot%\system32"& set "A=%systemdrive%\Users\Default\AppData\Local\Microsoft\Windows\WinX\Group3\01 - Command Prompt" >nul fltmc || ( if +%+% neq +A if exist "%A%.lnk" ( start "" /high "%A%.lnk" /x/d/rset+=A^&cmd /rcall "%~f0" %*&&exit/b0) else ( >nul reg add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "%tmp%\cmd.exe" /f /d RUNASADMIN >nul robocopy /lev:0 "%S%/" "%tmp%/" cmd.exe& start "" /high "%tmp%\cmd.exe" /x/d/rset+=A^&"%comspec%" /rcall "%~f0" %*&&exit/b0)) whoami /all echo [ %* ] pause exit This is what I use lately, it's very fast on windows 10 since it just calls cmd, and the lame defender won't randomly delay execution as it happens with ps or vbs commands. also has a fallback mode on windows 7 with a copy trick to set compatibility flags for built-in tools. safeguarded against loops if for some reason compatibility layer has been crippled by a zealous services "optimization". the most simple and effective passing of parameters since it's cmd on all ends, unlike ps or the horrible vbs "solutions". and the kicker feature is supporting most special characters spaces brackets whatever in paths, script names and (quoted) arguments.
Hi @BAU , thanks it is amazing idea and would be great help when calling cmd. But I might misleadingly express previously. I do want to call powershell.exe, and the argvs are all pass to it. Do I need to replace "01 - Command Prompt" with "01a - Windows PowerShell" and cmd with powershell? Thanks and best!
well, if your script is gonna use powershell anyway then just use powershell for elevation Code: :::: Relaunch as Admin passing cmdline args set _=call "%~f0" %*& fltmc>nul||(powershell -nop -c start cmd -args'/d/x/r',$env:_ -verb runas &&exit/b ||pause&exit/b)
Just a suggestion, the temporary folders (ESD, etc) could be placed in the same folder as the script or at least the drive the script is running from and not the C drive
you would think that, but microsoft hard-codes the working folder path and only offers an option to change a temp path where not much i/o happens
Can this be used to create the new Windows Server 2022 LTSC, with 10 years support it may be the answer to frequent versions appearing.
no. that's a different product unsuitable for consumers even with the desktop experience (and I dont think public esd's for it are available)
hmmm. noob here, how do i execute this the right way? Once i start the bat file it's responding very slow and does nothing? Update, seems it's activated but responding a little slow BUT working
Windows 11 has come early to MCT.. (actually, I added it back in September 3th, but "slept" on it so that I could implement a more elegant / reliable way to skip TPM Check with Dynamic Update)
Dynamic update is either for updating the ISO:\sources folder or for updating winre.wim, not for circumventing the system requirements.
Windows 11 already installs updates with no problem on unsupported hardware if you managed to get it It's only feature updates via windows update that are soft-blocked That's mainly for insider builds, but also running setup manually under windows (even if it's the same version as the installed one aka in-place update/repair) The proposed dynamic update workaround allows manual setup with Dynamic Update on (so that latest setup files are downloaded) as well as getting insider builds like 224xx via windows update
will only know on/after oct 5 and oct patch tuesday whether unsupported get updates thru wu or need bypass tool like win 7