Timing conflict in a batch file in x32Win10ProV22H2
SolvedSebastian42 Posts 63 Registration date Tuesday March 30, 2010 Status Member Last seen May 2, 2024 - May 2, 2024 at 06:05 AM
- Timing conflict in a batch file in x32Win10ProV22H2
- Windows 10 iso file download 64-bit - Download - Windows
- Kmspico zip file download - Download - Other
- Tiny 11 iso file download - Download - Windows
- Ping batch file output to text - Guide
- How to change time in whatsapp - Guide
11 responses
Apr 21, 2024 at 08:10 AM
The AI suggestion of using 'wait' has the weakness that although the execution of the the third command is delayed, what was NOT delayed was the appearance of the CMD window which processes that wait command. Rhat appearance spoils the snip.
Apr 22, 2024 at 10:39 AM
Hi,
Try replacing "start" by "call":
call "C:\Program Files\ToggleTaskbarAutohide\ToggleTaskbarAutohide.exe"
call "C:\Program Files\Macro Express Pro 6\MeProc.exe" /ASaveDeskTopView
call "C:\Program Files\ToggleTaskbarAutohide\ToggleTaskbarAutohide.exe"
"Call" will process all commands within the same command prompt window. It will also wait for each command to complete before starting the next one.
Let me know how it goes.
Apr 22, 2024 at 08:58 PM
There is NO CMD window superimposed on the snip, but the third command took effect before the second completed.
Apr 23, 2024 at 11:18 AM
Here's a workaround - add this line before the third command:
timeout /t 5 /nobreak
Execution of the last command will be delayed by 5 seconds. "nobreak" will prevent the command to be executed if a key is pressed.
You can adjust the timeout if necessary.
Apr 23, 2024 at 02:45 PM
As I expected, the time-out line triggers a CMD window which superimposes itself over the image i want a snip of.
Apr 23, 2024 at 04:10 PM
What if you try this one instead?
timeout /t 5 /nobreak>nul
If that persists, try adding @echo off at the beginning of your batch file. Otherwise, you could remove that third line and create instead a shortcut on your desktop in order to unhide your taskbar.
Apr 23, 2024 at 08:42 PM
'you could remove that third line and create instead a shortcut on your desktop in order to unhide your taskbar.'
Obviously I can - and have - until such time as I can get the batch file to work better.
You latest version still has the CMD window intruding on the image.
The latest
Didn't find the answer you are looking for?
Ask a questionUpdated on Apr 26, 2024 at 02:40 PM
I've another method you could try in order to prevent the batch file from appearing on the screen. You'll need to create a task in Task Scheduler and create a shortcut on your desktop to be able to start that task.
First of all, update your batch file with the latest changes:
@echo off
call "C:\Program Files\ToggleTaskbarAutohide\ToggleTaskbarAutohide.exe"
call "C:\Program Files\Macro Express Pro 6\MeProc.exe" /ASaveDeskTopView
timeout /t 5 /nobreak>nul
call "C:\Program Files\ToggleTaskbarAutohide\ToggleTaskbarAutohide.exe"
exit
Next, go to Task Scheduler. Right-click Task Scheduler Library and select Create Task. Give a name to your task (you'll need it later) then go to Actions > New.
Enter the following and save the task:
- Action: Start a program
- Program/script: %windir%\system32\cmd.exe
- Arguments: /C start /min C:\Users\YourName\Desktop\batch.bat
Don't forget to change the path pointing to your batch file.
Once the task is saved, go back to your desktop. Do a right-click to open the contextual menu and choose New > Shortcut, then enter:
schtasks /run /tn "TaskName"
TaskName corresponds to the name provided to your task in Task Scheduler.
Save the shortcut and you can test it. With this method, your batch file should run minimized - it won't appear on the screen.
I hope that will work as expected.
Good luck
Apr 25, 2024 at 05:22 AM
Sad to report, the process opens a CMD window and halts at
C:\WINDOWS\system32 >
Apr 26, 2024 at 02:40 PM
I've discovered a mistake, your batch file in "Add arguments" for the task must ends with .bat - I've corrected my previous answer. Check again the parameters to make sure everything is correct. Also, if your task or batch file has spaces in their filenames, try removing them to prevent potential issues.
Updated on Apr 29, 2024 at 02:41 PM
It is obvious that a batch file must end in '.bat'. Are you saying that you have corrected post #8, and I should now try it as it currently appears ?
On the assumption that the answer is YES, I tried it - and it succeeds ! Thank you SO MUCH !
Updated on Apr 29, 2024 at 02:40 PM
When I related my experience, as shown in the image, in this space, I could not submit it because of "Please enable Javascript. Please try again." which I do not know how to comply with, so I will send you an image of what I had written.
In the screenshot above, the '\/' instead of 'v' is an artifact of text-capture, and does NOT reflect the actual 'details' in Task Scheduler.
I have done it again - in my 'continuing system' - to the best of my knowledge just as above, without any renaming or relocating, and what happens is that a CMD window opens minimized, and stalls at ‘C : \WINDOWS\system32>
Apr 29, 2024 at 12:59 AM
I got it to work in my continuing system - using my own version of the batch file, with an increased first timeout.
Apr 29, 2024 at 02:39 PM
Great! Thanks for the update.
Apr 29, 2024 at 06:58 PM
Things keep changing ! Trial and error seemed to show that the first timeout had to increase, but it was not consistent, and has worked with both timeouts being just 1.
Functionality depended heavily on the path to the batch file - and I arranged for it to be C:\batch file, rather that the location where I prefer my batch files to be. Thank you once again.
May 2, 2024 at 01:08 AM
To ensure the third command waits until the second has fully completed, replace start
with start /wait
for the second command to make the batch process wait for the application to finish before proceeding to the next command.
May 2, 2024 at 06:05 AM
ZehraB
I have worked on this a long time - and have achieved success, so no more tweaking is needed.
Along the line I did use 'start/wait' and it did NOT have the desired effect.
I might add that there was inconsistency in the timeouts - working and NOT working for the same amounts.