I am making this simple project in which the program captures the user input and searches it up on google.
For example , if %variable% is the URL the user types, then
here is a "demo" of what I want:
start CHROME %variable%
Answer (Me)
I think I have an answer to my own question:
set /p urlinput=Search:
start CHROME %urlinput%
start CHROME google.com/search?q=%urlinput%*
I will be leaving this up in case people need to know the answer.
*You need to add Pluses between each word for the search to work
This works for me on Windows 10 for a search about javascript:
set /P URL_IN=""
< javascript
start chrome "https://www.google.com/search?q=%URL_IN%"
Where < javascript is the user input.
It is important to enclose the URL in quotes otherwise words get dropped after spaces.
Answer (Me)
I think I have an answer to my own question:
set /p urlinput=Search:
start CHROME %urlinput%
start CHROME google.com/search?q=%urlinput%*
I will be leaving this up in case people need to know the answer.
*You need to add Pluses beteen each word for the search to work
Related
I have a batch file which opens a pop-up within a website. The website opens fine, but when I want to add a parameter with a plus character, +, it doesn't work!
The code looks like this:
#echo off
start "Chrome" chrome --app=https://website.com?phone=%1
However the %1 will be replaced with the incoming number but without the + before it.
I don't why that happens so I tried to add a plus manually.
#echo off
start "Chrome" chrome --app=https://website.com?phone=+%1
But that doesn't work either!
Does anyone have an idea how to add the + sign to the url?
The desired result should be:
https://website.com?phone=+3112345678
That's because + is the url encoding for space.
To encode a plus sign you have to use %2b.
But in batch-files the percent sign is also a special character, therefore it has to be escaped itself by another percent sign.
https://website.com?phone=%%2B555-123
And the url should be quoted, because when more than one get parameter is present, then these parameters are separated by & signs, that collides again with the special meaning in batch files for command separation.
start "Chrome" chrome --app="https://website.com?phone=%%2B%1&name=John"
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'm trying to make a batch file that allows me to search for something on wikipedia. But instead of using /p and it asks me for input, I want to to automatically search. For example, I would type search Example, and it would search for example on wikipedia. Thank you in advanced.
P.S. I do not have any code currently, but to clarify I dont want to use /p %input% in the code.
Save this to a file named search.bat and you're done:
#start "" "http://en.wikipedia.org/wiki/Special:Search?search=%*"
The %* means all command-line arguments. So if, on the command line, you enter
search Example
The script launches your default web browser and opens the Wikipedia search page for Example. Wikipedia then redirects you either to the corresponding article or the disambiguation page, whichever is more appropriate according to Wikipedia's algorithms.
If you:
search snow cream
you instantly get taken to the Wikipedia entry for snow cream.
I'm trying to send network credentials using Net Use command.
This is what I have:
#echo off
net use \\<serverName>\<shareFolder>\ passw0rd /USER:domain.com\UserName
PAUSE
This automatically inserts the username and Domain but for some reason not the password!!
I have tried it like this as well:
#echo off
net use \\<serverName>\<shareFolder>\ /USER:domain.com\UserName passw0rd
PAUSE
I have checked the paths I'm using and they definitely work. When i copy them out and paste in RUN they work.
Same goes for the username and passwords.
Everything in google search is purple cause I've clicked on all the links :/
Ok, I thought I had it...
I tried it like this:
#echo off
net use \\<serverName>\<shareFolder>\ <mapName> /USER:domain.com\UserName passw0rd
PAUSE
And it worked, but only because i entered the password before i tried it like this and then it remembered the password.
So I'm still looking for a way.
Please help.
Does the password contain special characters like % / ~ or similar characters with special meaning in batch files?
Yes, then enclose the password in double quotes.
Use also double quotes around UNC path and test if that makes a difference.
What I miss in all your net use commands is the device name usually specified left of UNC path to shared folder to map the shared folder to a drive letter. Therefore it could be that the password is interpreted as device name.
But according to your question you want to pass only the user credentials and password to be able to access the shared folder using UNC path. However, I suggest to test if it makes a difference really mapping the shared folder to a drive letter. I don't know if the password string is interpreted as device name if no device name specified and can't test it by myself at the moment.
#echo off
net use <MapDriveName> \\<serverName>\<ShareFolder>\ /PASSWORD:<Passw0rd> /USER:<UserName>
PAUSE
This one works for me. Finally :)
Hope this can help someone else as well.
net use Y: \server_name OR ipaddress\shared /user:domainname\%username%
I've been racking my brain trying to get my softphone to dial numbers on web pages. I've gotten the browser to pass the number through to the softphone, but it adds tell:+ to the number and won't call out.
As a matter of last resort, I want to create a batch file to remove the tel:+ from the number. I have never written one before, but I imagine that it would be relatively simple.
The batch file just needs to open the tel: urls and remove tell:+ from the number before passing it on to the softphone.
I would really appreciate it if someone could point me in the right direction.
#echo off
set "URI=%~1"
set "URI=%URI:tel:+=%"
somecommand %URI%
Pass the URI as argument.
See help set for a detailed description.