I already know that to open a webpage with the default browser you use:
start www.google.com. However, I'm trying to open a URL that contains a '&' in it for example:
https://www.google.dz/?gws_rd=cr,ssl&ei=rXc_WYq3Msy2abGXpugH#safe=off&q=hello+world
If I use:
start https://www.google.dz/?gws_rd=cr,ssl&ei=rXc_WYq3Msy2abGXpugH#safe=off&q=hello+world
It will not work because there is a &
& is a special character in bash, so if the URL contains a special character you just have to do it like this:
start "" "your url"
You have to escape the Ampersand (&) character with the ^ character in every occurrence of it.
start https://www.google.dz/?gws_rd=cr,ssl^&ei=rXc_WYq3Msy2abGXpugH#safe=off^&q=hello+world
Powershell
By passing through powershell : powershell Start-Process <browser> <URL>.
If you don't specify browser, then URL is open in your default browser. Mine is Google Chrome, so i have added chrome. For internet explorer, it will be iexplorer and for Mozilla Firefox, this is firefox.
Examples from a CMD prompt :
powershell Start-Process chrome http://google.com/
or a little bit shorter :
powershell Start-Process http://google.com/
or even more shorter :
powershell start http://google.com
However, in your case, type in the one hand powershell command to goto powershell prompt. In the other hand, just type one of the following command line by specifying URL with "" in order to dodge the & effect as explained by jgmh above :
start "https://www.google.dz/?gws_rd=cr,ssl&ei=rXc_WYq3Msy2abGXpugH#safe=off&q=hello+world"
or by chosing a specific browser such as firefox :
start firefox "https://www.google.dz/?gws_rd=cr,ssl&ei=rXc_WYq3Msy2abGXpugH#safe=off&q=hello+world"
or else :
[System.Diagnostics.Process]::Start("firefox.exe","https://www.google.dz/?gws_rd=cr,ssl&ei=rXc_WYq3Msy2abGXpugH#safe=off&q=hello+world")
Finally, type exit in order to quit the powershell prompt.
CMD
Using start command only
idris19's method is really handy !
This command line can also help you because you are able to indicate your browser : start <browser> <URL>.
As said before, URL is open in your default browser if none is specified.
For instance :
start http://google.com
or
start chrome http://google.com
But, in your case, don't forget to add "" to avoid & issue and mention your browser to not run URL in another cmd window :
start chrome "https://www.google.dz/?gws_rd=cr,ssl&ei=rXc_WYq3Msy2abGXpugH#safe=off&q=hello+world"
You can add -incognito flag to goto an incognito browser if necessary :
start chrome "https://www.google.dz/?gws_rd=cr,ssl&ei=rXc_WYq3Msy2abGXpugH#safe=off&q=hello+world" -incognito
Using windows explorer
Furthermore, you can use windows explorer as following : explorer <URL>.
It always will open your URL in the default browser.
Example :
explorer http://google.com
As previously mentioned, don't forget the double quotes in your case due to & special character :
explorer "https://www.google.dz/?gws_rd=cr,ssl&ei=rXc_WYq3Msy2abGXpugH#safe=off&q=hello+world"
Note : Tested on Windows 10 64bits.
P.S : Please, don't hesitate to edit my answer because i probably made grammatical mistakes due to my low english level. Thanks !
Best regards :-)
You can use URL shorteners.
For your link:
start [created link]
If you have Linux you can try using these command
$links http://google.com
or
$elinks http://google.com/
First provide the full path to the browser application file and then the complete link like this:
start "C:\Path\To\Browser.exe" "http://WebsiteURL.com"
Try one of these command lines:
powershell -command "start 'https://www.google.dz/?gws_rd=cr,ssl&ei=rXc_WYq3Msy2abGXpugH#safe=off&q=hello+world'"
or
start "" "https://www.google.dz/?gws_rd=cr,ssl&ei=rXc_WYq3Msy2abGXpugH#safe=off&q=hello+world"
or even this one:
explorer "https://www.google.dz/?gws_rd=cr,ssl&ei=rXc_WYq3Msy2abGXpugH#safe=off&q=hello+world"
When I tried the same, it worked for me only by typing :
C:\start https://www.google.dz/?ws_rd=cr,ssl&ei=rXc_WYq3Msy2abGXpugH#safe=off&q=hello+world
in the Command Prompt.
You can do it using start chrome -u url here.
Related
at the moment im trying to open a pdf file %UserInputID%.pdf in fullscreen but i dont quite get it to work.
At the moment im just doing start "" /max "path\%UserInputID%.pdf".
I did find out about outdated workarounds with powershell that use SendKeys but as that is not completly supported anymore (?) i thought about using the startparameter of edge/chromium. But how? How to use --start-fullscreen as a parameter? Just appending it like -parameter \%UserInputID%.pdf" ---start-fullscreen does not work, neither does /parameter \%UserInputID%.pdf" /--start-fullscreen. Happy for every answer or hint.
*Edge is the standard pdf programm
*Edit / Addendum: After KJ's Answer I also figured
start "name" "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --start-fullscreen file:///"path\%UserInputID%.pdf"
as a (partial) valid answer. Partial because if only a single (partial) instance of edge is still open (normal x doesnt do the job) it wont work, as it seem like it cant "start" in fullscreen if it is already open in non fullscreen mode.
There are in your case two ways to use MSEdge
The first as you know is if it is the default pdf application then it will use current edge profile to open the pdf so as you describe we can simply use
start "" /max "mydemo.pdf"
And Edge will use its default settings to display MyDemo.PDF in a window but will ignore the /MAX request.
It is the same if we call it directly
start "" /max msedge "file:///C:\mypath\mydemo.pdf"
However we can use it in Kiosk mode
start "" "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --kiosk --no-first-run --edge-kiosk-type=fullscreen file:///C:\mypath\mydemo.pdf
if you wish you can also add a minute timer for auto release to normal mode but it is minutes not seconds
--kiosk-idle-timeout-minutes=1
as comment added to question you can also run the second session as
start "" "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --start-fullscreen --no-first-run --edge-kiosk-type=fullscreen file:///C:\mypath\mydemo.pdf
I am looking for a way to create a Powershell script that will allow me to open DB Browser for SQLite ("C:\Program Files\DB Browser for SQLite\DB Browser for SQLite.exe") and upon opening, load a file (C:\Users\XXXXX\AppData\Roaming\AirHauler2XP\Company\Atlas Airlines25045 PM.db) in order for me to edit. Any help would be great (if possible).
Please see the documentation: https://github.com/sqlitebrowser/sqlitebrowser/wiki/Command-Line-Interface#examples
According to that, it should be:
"C:\Program Files\DB Browser for SQLite\sqlitebrowser" "C:\Users\XXXXX\AppData\Roaming\AirHauler2XP\Company\Atlas Airlines25045 PM.db"
#ChristianBaumann is OK, and it will work from command prompt. But for powershell this will fail. You need to use & to run it:
& "C:\Program Files\DB Browser for SQLite\sqlitebrowser.exe" "C:\Users\XXXXX\AppData\Roaming\AirHauler2XP\Company\Atlas Airlines25045 PM.db"
I would add it to the path one way or another.
$env:path += ';C:\Program Files\DB Browser for SQLite'
cd AppData\Roaming\AirHauler2XP\Company
sqlitebrowser '.\Atlas Airlines25045 PM.db' # tab completion on the filename
I wanted to make a batch program to start all of my web browsers and open them to a websites saved on my computers local storage. Everything works correctly until the URL is copied into cmd and it changes the link.
start "" "Google Chrome" "file:///C:/Users/User/Desktop/Programming/Web%20Dev/Websites/PRP%20Website/index.html"
When I run this code the two places there is %20, only a 0 gets put into the cmd so the new code looks like this
start "" "Google Chrome" "file:///C:/Users/User/Desktop/Programming/Web0Dev/Websites/PRP0Website/index.html"
I do know I could change the folder name and the problem would be fixed, but I was hoping there would be a way to fix this problem with code and not the file names
The core problem is that cmd.exe is interpreting "%2" as the second parameter on the command line. Since there is no second parameter on the command line "%2" is replaced with nothing. This can be overcome by:
1) Replace "%20" with a SPACE " " character
2) Escape the "%" with another "%" character, resulting in "%%20".
How do you open a website from startup, that'll run in fullscreen mode as well?
Using /max doesn't seem to do anything. That's for maximizing the screen. I want it to be like when F11 is pressed when you visit a website.
This is my file
#echo off
start chrome --profile-directory="Profile 1" "https://stackoverflow.com/"
I've also looked into automatically having a key typed, but I can't get it to work. This is my first dabble with batch-file. Maybe it'll help you though:
WScript.CreateObject("WScript.Shell").SendKeys("{F11}");
EDIT:
The answer to this similar question isn't what helped me. As I've stated, /max is just to maximize the screen, whereas I want it to go fullscreen.
To send keys exactly to the window you want you have to focus on it first with AppActivate function.The sendKeys.bat do both with a single script
here's an example (at the moment I have no chrome driver so I'm using the standard chrome):
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "http://stackoverflow.com/"
call sendKeys.bat "Stack" "{F11}"
the first argument is the title and the second the keys to be send.
According to this list --start-fullscreen argument should also work
Here are a few ways to do this.
start "" "iexploerer.exe" -k "https://someurl.com"
start "" "chrome.exe" -kiosk "https://someurl.com"
start "" "firefox.exe" -kiosk "https://someurl.com"
I am creating a batch file in windows with the following command in it.
start https://abcd.com/command?username=user&password=pass&mode=desktop
I am expecting this to open default browser with this URL when running it. It does open the default browser, but the URL that was opened in the browser is actually truncated.
https://abcd.com/command?username=user
What should I give in the URL to make it posted completely?
& is a special character in batch scripting. Just quote the URL and pass an empty string as the title:
start "" "https://abcd.com/command?username=user&password=pass&mode=desktop"
You should be able to do this by inserting a caret before the ampersand:
https://abcd.com/command?username=user^&password=pass^&mode=desktop