Discussion:
Windows batch file command line command to open tor browser and multiple websites at the same time
(too old to reply)
Oscar Mayer
2023-11-13 03:23:11 UTC
Permalink
This was asked & answered a dozen years ago on stackoverflow.
https://stackoverflow.com/questions/10602490/batch-file-to-open-tor-browser-and-several-websites

It was viewed over three thousand times.
So I can't question that it works.

Plus I tried it on Windows 10, and it works.
Even though I have Tor set to not "Connect" until I click the button.
But why does that command line have an odd number of double quotes?

Batch file to open tor browser and several websites
start "" "C:\Users\%USERNAME%\Desktop\SHORTCUT.lnk" "https://www.google.com" "https://www.duckduckgo.com" "

But what does the extra (odd number) ninth double quote do?
Is that ninth double quote a typo that nobody ever noticed?

A minor followup question is about pressing the "Connect" button
when the tor browser bundle is configured to require a manual click.

Can that Connect action be forced in the command line?
Paul
2023-11-13 06:24:19 UTC
Permalink
Post by Oscar Mayer
This was asked & answered a dozen years ago on stackoverflow.
https://stackoverflow.com/questions/10602490/batch-file-to-open-tor-browser-and-several-websites
It was viewed over three thousand times.
So I can't question that it works.
Plus I tried it on Windows 10, and it works.
Even though I have Tor set to not "Connect" until I click the button.
But why does that command line have an odd number of double quotes?
Batch file to open tor browser and several websites
start "" "C:\Users\%USERNAME%\Desktop\SHORTCUT.lnk" "https://www.google.com" "https://www.duckduckgo.com" "
But what does the extra (odd number) ninth double quote do?
Is that ninth double quote a typo that nobody ever noticed?
A minor followup question is about pressing the "Connect" button
when the tor browser bundle is configured to require a manual click.
Can that Connect action be forced in the command line?
I think the reason it "works", is for some things I tested, "excess input"
on the line was simply ignored. If I put a Mrs.Fields cookie recipe
on the line, the program launches, it "eats" one argument, and basically
does not consume any more of what is passed to it. Whether balanced quote
or unbalanced quote.

When I passed two URLs to an ordinary browser, mine seems to ignore
everything after the first element.

Write yourself a test application that prints out ARGC and ARGV and
see what is passed. I bet, as you predict, the double quote *is*
treated as input.

In fact, I already have such a program in my collection, and I had to
modify it slightly for launch into outer space.

******* bobble.c A program to print ARGC and ARGV for console testing *******

#include <stdio.h>

/* gcc -o bobble.exe bobble.c # default optimization */

int main(int argc, char** argv)
{
printf("ARGC is %d\n", argc);

for(int i = 0; i < argc; i++) {
printf("ARGV[%d] is %s\n", i, argv[i]);
}

/* fgets seems to stop after BUFSIZ characters are entered as input */

char line[BUFSIZ];

fputs("\nTo quit the program, press the return key now", stdout);
fflush(stdout);
fgets(line, sizeof line, stdin);

return 0;
}

******* bobble.c A program to print ARGC and ARGV for console testing *******

This is what I got in a test of Mr.Bobble .

[Picture]

Loading Image...

In fact, weird as it may seem (and yes it is weird), these commands all do the same thing!

D:\>start "titlebar" bobble "site1" "site2" "
D:\>start "titlebar" bobble "site1" "site2" ""
D:\>start "titlebar" bobble "site1" "site2" """
D:\>start "titlebar" bobble "site1" "site2" """"
D:\>start "titlebar" bobble "site1" "site2" """""

And this does what you would expect of a careless command interpreter.

start "titlebar" bobble "site1" "site2" "baloney

It has three arguments site1 site2 baloney

So it did not even choke on the unbalanced double-quote.

While that individual may have made a mistake, the environment
handles the whole situation with some sort of "grace" :-)

Pretty funny for a computer to be doing that.

There should be a 0xC0000005 error or a crash or something, right ?

Paul
JJ
2023-11-13 06:53:05 UTC
Permalink
Post by Oscar Mayer
This was asked & answered a dozen years ago on stackoverflow.
https://stackoverflow.com/questions/10602490/batch-file-to-open-tor-browser-and-several-websites
It was viewed over three thousand times.
So I can't question that it works.
Plus I tried it on Windows 10, and it works.
Even though I have Tor set to not "Connect" until I click the button.
But why does that command line have an odd number of double quotes?
Batch file to open tor browser and several websites
start "" "C:\Users\%USERNAME%\Desktop\SHORTCUT.lnk" "https://www.google.com" "https://www.duckduckgo.com" "
But what does the extra (odd number) ninth double quote do?
Is that ninth double quote a typo that nobody ever noticed?
A minor followup question is about pressing the "Connect" button
when the tor browser bundle is configured to require a manual click.
Can that Connect action be forced in the command line?
That lone last double-quote is just a typoe by the poster. It's not required
to make everything work.

Double-qoute is a marker for start & end of one command line argument. So,
if the lone double-quote is at the end of a command line, that last command
line argument is empty.

Tor/Firefox will ignore empty arguments. It would be different if an
argument is not empty. e.g. if there's a space following the lone
double-quote. Here, the argument is a space. i.e. an URL which is nothing
but a space. For a web browser, an URL which is nothing but space(s), is
same as `.`, which is same as the current directory. So, the web browser
will open the current directory in the local file system.

Loading...