1

So, I am very bad at using the CMD program and I'm just trying to do something for fun. In my mind, it is very basic. I want to open a .bat file, that prompt an "echo" question so when I press any key it opens a program A and a URL X, then ask me again if I want to open another program B by pressing any key.

My problem is that it works only if the first program is already open on my PC. If it's not, it only prompts the first "echoes", open my URL , then nothing else happen. Ctrl+Z doesn't seem to resume the script to the next line.

Here is what it currently looks like:

@echo off
color 0a
title MY TITLE
echo -Welcome
echo -Do you want to do something ?
echo -I can open "an URL X" and "a program A"
pause
start https://URL X
"C:\Program Files\program A"
echo -Windows open successfuly. Do you want to start now ?
>Pause>nul|(echo Press any key to launch the best program in the world...)
"C:\Users\program B"

Thanks in advance if anyone can help me with this :)

Dissolvant
  • 11
  • 1

1 Answers1

0

This works for me

@echo off
color 0a
title MY TITLE
echo -Welcome
echo -Do you want to do something ?
echo -I can open "an URL X" and "a program A"
pause
start https://superuser.com/
start "" "C:\Program Files\program A"
echo -Windows open successful. Do you want to start now ?
pause
echo Press any key to launch the best program in the world...
start "" "C:\Users\program B"
user2380383
  • 327
  • 1
  • 10
  • Thank you for your answer ! I will test it very soon. I see that you use two " " before the actual "file path". I don't remember anything like that during my (poor) researches because I think I would have test it otherwise. What does it tells the batch/script/cmd prompt to do ? (omg I'm so lost in the vocabulary) – Dissolvant Jun 25 '20 at 19:52
  • See [“start” command with spaces in the path](https://superuser.com/a/239572/526982) – user2380383 Jun 26 '20 at 12:11
  • Thanks for you help, it works perfectly now :) – Dissolvant Jun 26 '20 at 16:58