From Newsgroup: alt.msdos.batch
On 11/12/2023 10:23 PM, Oscar Mayer wrote:
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]
https://i.postimg.cc/ZKXCV9VD/test-argument-passing-with-bobble.gif
In fact, weird as it may seem (and yes it is weird), these commands all do the same thing!
start "titlebar" bobble "site1" "site2" "
start "titlebar" bobble "site1" "site2" ""
start "titlebar" bobble "site1" "site2" """
start "titlebar" bobble "site1" "site2" """"
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
--- Synchronet 3.21d-Linux NewsLink 1.2