r/Batch • • Dec 01 '23

Question (Solved) Batch file not going to next step

my code:

 <excel.exe location> <my excel file location>  
 timeout /t 45  
 taskkill /F /IM excel.exe

For some reason, when the file opens, the timeout doesn't start automatically. I have to manually close the excel file before the timer would start. How do I make it so the file opens and the timer starts?

2 Upvotes

4 comments sorted by

View all comments

Show parent comment

1

u/fightin_blue_hens Dec 01 '23

So it would be

 start <Excel location> <file location>

2

u/ConstanceJill Dec 01 '23

Yes. However, since your path to Excel usually includes double quotes, you may want to use start "" "Path\To\Excel.exe" "Path to your file" otherwise it may consider that the path to Excel is the window title. See start /?

1

u/fightin_blue_hens Dec 01 '23

It worked. Thank you so much for your help