1

How can I open this link using command line code?

I think I have a mistake with my code:

if %X% EQU 28 srart http://www.tele-live.com/mbc-max-en-direct-live-%DA%BA%C3%AA-%C2%A0%C3%AF-%C2%AB%C3%AF-%C3%AA%DA%BA%C3%A8%C2%AB-%C3%AA%C2%A0%DA%BA%C2%AC%C2%A9%20-video_0a915c1da.html
twasbrillig
  • 17,084
  • 9
  • 43
  • 67
MB_Coder
  • 765
  • 1
  • 7
  • 14
  • Using this "start http://www.tele-live.com/mbc-max-en-direct-live-%DA%BA%C3%AA-%C2%A0%C3%AF-%C2%AB%C3%AF-%C3%AA%DA%BA%C3%A8%C2%AB-%C3%AA%C2%A0%DA%BA%C2%AC%C2%A9%20-video_0a915c1da.html" (use without Quotation mark) – Parth Akbari Nov 17 '14 at 04:35
  • [SuperUser Question](http://superuser.com/questions/719346/open-a-website-in-internet-explorer-from-command-line) – Parth Akbari Nov 17 '14 at 04:44
  • thank you Parth Akbari this link work with my browser but doesn't work with my batch-file ?? – MB_Coder Nov 17 '14 at 05:03
  • this might be help u [Stackoverflow](http://stackoverflow.com/questions/20782734/open-a-url-without-using-a-browser-from-a-batch-file) – Parth Akbari Nov 17 '14 at 05:08
  • is `srart` a typing error here, or is it in your actual code? – Stephan Nov 17 '14 at 06:11
  • Are the `%` symbols required in the URL? You have to escape those. – SomethingDark Nov 17 '14 at 13:10

2 Answers2

1

Reference Start a program, command or batch script (opens in a new window.):

Syntax

START "title" [/D path] [options] "command" [parameters]

Key:

  • title Text for the CMD window title bar (required.)
  • path Starting directory.
  • command The command, batch file or executable program to run.
  • parameters The parameters passed to the command.
  • title Text for the CMD window title bar (required.)
  • path Starting directory.
  • command The command, batch file or executable program to run.
  • parameters The parameters passed to the command.

Things to note:

  • title argument is required
  • command should be quoted with " characters.

"I think I have a mistake with my code:"

if %X% EQU 28 srart http://www.tele-live.com/mbc-max-en-direct-live-%DA%BA%C3%AA-%C2%A0%C3%AF-%C2%AB%C3%AF-%C3%AA%DA%BA%C3%A8%C2%AB-%C3%AA%C2%A0%DA%BA%C2%AC%C2%A9%20-video_0a915c1da.html

There are three things I can see that might cause problems with the above code:

  1. You have a spelling mistake, srart should be start,
  2. You don't have a title parameter (which is required)
  3. command is not quoted. Note that quotes are required if the command includes any of the following special characters & \ < > ^ | so it a good idea to always quoted the command.

Please try the following:

if %X% EQU 28 start "mytitle" "http://www.tele-live.com/mbc-max-en-direct-live-%DA%BA%C3%AA-%C2%A0%C3%AF-%C2%AB%C3%AF-%C3%AA%DA%BA%C3%A8%C2%AB-%C3%AA%C2%A0%DA%BA%C2%AC%C2%A9%20-video_0a915c1da.html"
DavidPostill
  • 7,734
  • 9
  • 41
  • 60
  • A title is only required if there are quotes in the command. `start iexplore.exe` and `start "" "iexplore.exe" ` both function equally. – SomethingDark Nov 17 '14 at 10:01
0

You can do it like this:

start browser.exe www.example.com

But. you need to set this to enviroment variables:

browser.exe C:\path\to\yourbrowser.exe Search up a tutorial on how to setup enviromental variables based on your Windows If you want to skip and use Internet Explorer, do this:

start iexplore.exe www.example.com

In another way you can also do this:

start C:\path\to\browser.exe www.example.com

But, if you want to use Chrome for example do this:

start C:\Program Files\Google\Chrome\Application\chrome.exe www.example.com

And if you want to use the same way for your code do this:

if %X% EQU 28 start iexplore.exe http://www.tele-live.com/mbc-max-en-direct-live-%DA%BA%C3%AA-%C2%A0%C3%AF-%C2%AB%C3%AF-%C3%AA%DA%BA%C3%A8%C2%AB-%C3%AA%C2%A0%DA%BA%C2%AC%C2%A9%20-video_0a915c1da.html

For example i want to use Chrome for this:

if %X% EQU 28 start C:\Program Files\Google\Chrome\Application http://www.tele-live.com/mbc-max-en-direct-live-%DA%BA%C3%AA-%C2%A0%C3%AF-%C2%AB%C3%AF-%C3%AA%DA%BA%C3%A8%C2%AB-%C3%AA%C2%A0%DA%BA%C2%AC%C2%A9%20-video_0a915c1da.html

Bye..