Search code examples
batch-filecmd

How can i start all of them immediately


It is pretty newbie question, but very important for me. I have simple scenario in bat. for economy of my time.

start 
"C:\Users\user\Desktop\IDLE (Python 3.8 32-bit).lnk"
"C:\Users\user\Desktop\PyCharm Community Edition 2020.1.2.lnk"
"C:\Users\user\Desktop\A_Byte_of_Python_2.01.pdf"

Programs open one after the other with a delay. This is problem. How to run all programms at the same time? Immediately. In one second.


Solution

  • If you take a look at the usage information for the Start command, i.e. start /?, you'll note that the first doublequoted command is read as the window title. So to prevent your doublequoted paths being misunderstood as titles, you'd use an actual or empty title.

    @Start "" "%UserProfile%\Desktop\IDLE (Python 3.8 32-bit).lnk"
    @Start "" "%UserProfile%\Desktop\PyCharm Community Edition 2020.1.2.lnk"
    @Start "" "%UserProfile%\Desktop\A_Byte_of_Python_2.01.pdf"
    

    You could even shorten that by changing directory first:

    @CD /D "%UserProfile%\Desktop"
    @Start "" "IDLE (Python 3.8 32-bit).lnk"
    @Start "" "PyCharm Community Edition 2020.1.2.lnk"
    @Start "" "A_Byte_of_Python_2.01.pdf"
    

    Alternatively, you could use a For loop:

    @For %%G In ("IDLE (Python 3.8 32-bit).lnk","PyCharm Community Edition 2020.1.2.lnk","A_Byte_of_Python_2.01.pdf") Do @Start "" "%UserProfile%\Desktop\%%~G"