Again: see my previous posts:
Errors you have are caused because path you have does not exist on every device you have. So you have to use the first version which checks the existence of the files.
It is possible that .ahk runs and does not wait until it finishes? (I don't know how .ahk works) This requires another approach. How do you run .ahk files manually? This info will help.
If you execute (start) your .ahk file from within the command prompt: does it return to the prompt before it actually completes the job?
And this one for the latest command:
Code: Select all
@for %%f in (C D E F) do echo ---&dir %%f:\Dropbox\AHK\Autohotkey.ahk&dir %%f:\Dropbox\AHK\TextExpansion.ahk&pause
What you get?
With the code above we should be able to see if both your .ahk files are there - but we can't because you don't provide the output.
so when using this below, it only launches the first script, and not the second/third script. why is that so and how do I fix it?
It will launch both commands (scripts) one after the other and the PAUSE command as you already know - so all three commands were executed.
That is why I asked you what happens if you execute the .ahk file from the command prompt (or with double click):
It is possible that .ahk runs and does not wait until it finishes? (I don't know how .ahk works) This requires another approach. How do you run .ahk files manually? This info will help.
If you execute (start) your .ahk file from within the command prompt: does it return to the prompt before it actually completes the job?
If you start
both .ahk files one after the other: do you have your work done as expected? If not then I guess you have to run the first .ahk file, wait for it to finish and then you have to start the second .ahk file. So what is it?
Maybe this will work:
Code: Select all
@echo off
for %%f in (C D E F) do if exist "%%f:\Dropbox\AHK\Autohotkey.ahk" if exist "%%f:\Dropbox\AHK\TextExpansion.ahk" (
title Running %%f: Autohotkey.ahk
start "" /wait /b cmd /c "%%f:\Dropbox\AHK\Autohotkey.ahk"
title Running %%f: TextExpansion.ahk
start "" /wait /b cmd /c "%%f:\Dropbox\AHK\TextExpansion.ahk"
)
echo Done.
pause
If I run test.cmd:
Code: Select all
@echo off
break>test1.tmp
break>test2.tmp
for %%f in (C D E F) do if exist "%%f:test1.tmp" if exist "%%f:test2.tmp" (
title Running %%f: Autohotkey.ahk
ECHO start "" /wait /b cmd /c "%%f:\Dropbox\AHK\Autohotkey.ahk"
start "" /wait /b cmd /c "dir %windir%"
title Running %%f: TextExpansion.ahk
ECHO start "" /wait /b cmd /c "%%f:\Dropbox\AHK\TextExpansion.ahk"
start "" /wait /b cmd /c "dir %windir%"
)
del test1.tmp
del test2.tmp
echo Done.
pause
It works as expected.
It might work without
Depends how .ahk files are executed.
Very important: you must check for the presence of the .ahk files to avoid getting any errors (the IF EXIST statements).
Saso