@echo off
@powershell.exe -ExecutionPolicy Bypass -Command "$_=((Get-Content \"%~f0\") -join \"`n\");iex $_.Substring($_.IndexOf(\"goto :\"+\"EOF\")+9)"
@goto :EOF
Start-Process microsoft-edge:https://yoomoney.ru/moneylandia/lootboxes
Start-Sleep 5
Get-Process -Name "*msedge*" | Stop-Process
echo %~nx0 completed!
pause
@echo off
REM для https://qna.habr.com/q/1027240
set C=%~nx0
if NOT "%DEBUG%" equ "" echo Running with DEBUG set
REM using two environment parameters: C and DEBUG
REM NOTE: passing arguments appears tricky when
REM powershell run with command built inline as string
@powershell.exe -ExecutionPolicy Bypass -Command "$debug=$env:DEBUG;$s=(get-content \"%~f0\") -join \"`n\"; $s = $s.substring($s.IndexOf(\"goto :\"+\"EOF\")+9);if ($debug -ne $null){write-output (\"Running:`n{0}\" -f$s);} invoke-expression -command $s"
@goto :EOF
# powershell code
start-sleep 5
write-output ( 'Calling script: {0}' -f $env:C)
pause
exit 0
c:\Users\sergueik\Desktop>set debug=1
c:\Users\sergueik\Desktop>show_caller.cmd
Running with DEBUG set
Running:
Start-Sleep 5
write-output ( 'Calling script: {0}' -f $env:C)
pause
exit 0
Calling script: show_caller.cmd
Press Enter to continue...:
start
и утилиты tasklist
, taskkill
и timeout
примерно так:@start microsoft-edge:https://yoomoney.ru/moneylandia/lootboxes
@timeout /t 5 /nobreak>nul
@for /f %%1 in ('tasklist^|find /i "msedge"') do @taskkill /im %%1 /f
@echo %~nx0 completed!
@pause
@echo off
@powershell.exe -ExecutionPolicy Bypass -Command "$fn = \"%~f0\"; $_=((Get-Content $fn) -join \"`n\");iex $_.Substring($_.IndexOf(\"goto :\"+\"EOF\")+9)"
@goto :EOF
Start-Process microsoft-edge:https://yoomoney.ru/moneylandia/lootboxes
Start-Sleep 5
Get-Process -Name "*msedge*" | Stop-Process
echo "$fn completed!"
pause