Reset to default
Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.
It falls back to sorting by highest score if no posts are trending.
If the last command fails pause won’t work.
You can fix it by putting “call” behind the command you are running (whatever command is before the pause) then the pause will work.
So for example I had a phpunit batch file that looked like this:
phpunit tests/sometests.php pause
When phpunit failed it just exited without pausing. Changing it to this made it pause correctly:
call phpunit tests/sometests.php pause
Does the last command before pause execute successfully? Mind sharing your script – at least last few commands?
Alternatively, since you seem to be using Windows7, try Timeout command and see if that is working.
I was having issues even on echo…
assuming it was caused by long batch file… Pause was executing but it was not pausing, it was almost like that it was pressing a key after Pause was executed.
Tried suggested solutions above; none worked.
So just for future reference, here is what I did:
Basically just “pause > nul && pause > nul”; works every time.
@echo off CALL :ForcePause "Press any key to resume." ECHO. ECHO Hello World! ECHO. CALL :ForcePause "Press any key to exit." EXIT REM You can remove echo if you don't want to pass custom string for pause :ForcePause echo %~1 pause > nul && pause > nul GOTO :EOF
I think i know where is the issue, i had the same problem. So if you are making it like this, you creating a new file and put all the batch info inside it and save it like normal text and after this just rename the extension it won’t work :). You have to save it via the text editor and from there you have to choose “Batch file(.bat;.cmd;*.nt)” for example Notepad++, its probably because of the encoding so do it like this and i thnk it will be ok. GL ! 🙂
Just addition to Tim’s answer, if you want the window to always display, you can write the .bat file like:
call phpunit tests/sometests.php cmd /k
I have the same problem. This occurs because of two reasons:
The first one is when running the batch file as administrator.
I have moved my batch file to desktop and try it as administrator and it works fine.
I have tried moving the batch file to any disk root (like C:\ D:\ etc.) and it works correctly.
I have tried moving the batch file to any directory with spaces and it works correctly.
The second and main reason is: There was some special characters (like @ or & or something like that) in the batch file’s directory.
Just find this special character and remove it from the folder name. And it will work correctly.
I couldn’t understand why
pause was only briefly pausing in my script. The answers here helped me solve the problem, and I finally figured out what was happening in my case:
If you run an application with
start /b it is possible the application will send some output to stdout after a delay. If that output comes when the
pause command is running, it will be interpreted as keystrokes and, naturally, the script will continue. You will most certainly have this issue if you use
start /b with commands that connect to remote computers:
start /b plink [email protected] -pw raspberry "sudo apt-get update" pause
The workaround is to use
pause >nul && pause instead
FYI: nothing shown above worked for me in Win7.
However, this DID finally work:
This also did NOT work for ‘timeout’.
Without it, it gets this:
ERROR: input redirection not supported,...
With it, it gets this:
ERROR: The handle is invalid.
In my case, this occurred after doing this:
start /WAIT cmd.exe /V:ON /k "set IEdir & pushd %IEdir% & cd & call "C:\Program Files\Internet Explorer\iexplore.exe" & set XsetRC1=!errorlevel! & set Xset & echo Xrc1=!XsetRC1! & popd & timeout /T 3 & EXIT !XsetRC1!"
where IE returns an RC=1 (what a KILL also gets).
However, doing the exact same for FireFox and Thunderbird:
start /WAIT cmd.exe /V:ON /k "set FFdir & pushd %FFdir% & cd & call "C:\FireFox\FireFox.exe" & set XsetRC1=!errorlevel! & set Xset & echo Xrc1=!XsetRC1! & popd & timeout /T 3 & EXIT !XsetRC1!"
where FF and TB returns an RC=0, ‘timeout’ DOES work properly.
Also note that PAUSE does NOT fail in Win10.