Batch file to open fullscreen website - batch-file

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"

Related

Open PDF with Edge in Fullscreen through Batch

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

Using start command in msconfig

The following command works just great as the only line in a batch file:
start "Google Sync" /belownormal "C:\Program Files\Google\Drive\googledrivesync.exe" /autostart
When I drop that line into msconfig startup tab, however, nothing happens.
So I thought maybe I needed to put in the full path to start.exe. Assuming it was an exe, that is.
So I tried both DIR and WHERE to locate start.* but nothing came up.
So, two 2uestions.
Is start a separate START.EXE executable in W7Pro and if so where is it?
How can I get this line to work inside msconfig?
Before you ask, my underlying purpose is to start Google Backup and Sync in the same way it usually does, but with /BELOWNORMAL priority. I already tried adding /BELOWNORMAL to the line Google was originally using in msconfig, without success. But START does what I want from a batch file and so I assume it would, or should, work via msconfig.
Thanks.
If you want to use commands implemented by Cmd.exe you must invoke Cmd.exe:
cmd /c start "Google Sync" /belownormal "C:\Program Files\Google\Drive\googledrivesync.exe" /autostart

Positioning the batch window

I am trying to find a way to adjust the window that opens while you are running a batch file WITHOUT using 3rd party programs. I have adjusted the size and color of it, but would like to move the window to the top left corner of the screen. This also has to be self contained in the batch file it self(not right-clicking on title bar and changing the settings of window position that way).
So for example, I have a batch file that opens, you answer the questions it asks then it opens the required program to finish the tasks(such as logging you into putty). But then, I would like the batch window to move to top left(already adjusted size and color to make it more noticeable) so it's easier for the user to click on it to see the "codes" I added to it to use in putty.
This is going to be distributed to multiple users and we can't add 3rd party programs and I don't want to have to explain to everyone how to adjust how the window opens, I just want it to always open top left(no matter how the computers are set up).
Lastly, all PCs are running Windows 7 and thanks in advance for the help!
Run the batch file from Start-Run:
set title=COMMAND PROMPT
reg add "hkcu\console\%title%" /v WindowPosition /t REG_DWORD /d "0" /f
start "%title%" cmd "%~f0 %title%"
exit /b

Prevent Call Statements From Running At The Same Time - Batch

I am using a .bat file to open up multiple windows for a program to expedite software installation and computer setup. The result I am looking for is that when I click the "X" to close out of one window, I want the next call statement to execute and open the next statement on the list. This works fine when the call statements have the same filetype. Example:
#echo off
call "New Text Document.txt"
call "New Text Document (3).txt"
#pause
But let's say I add a statement that calls a web browser in between my two text file calls.:
#echo off
call "New Text Document.txt"
call "a.url"
call "New Text Document (3).txt"
#pause
Now is when I experience the issue. When I close my first text file it will open up "a.url" and "New Text Document (3).txt" at the same time instead of one sequentially after I close out of one of them like it does when I just have two text files.
I understand that if I put #pause in between my call statements I won't have this problem and it would still speed up the software/setting setup process greatly, but I would really like to have it open things sequentially after closing a window instead. What can I do to resolve this?
Thanks in advance for all help offered.
Try to replace your call commands with start
start "" /wait "new document.txt"
start "" /wait cmd /c "something.cmd"
start "" /wait calc.exe

Locking focus on batch file

I have a simple batch file in windows that I run on startup that presents the user with a menu to start certain applications. However by default, whenever I open one of these applications the focus goes to that window and off of the batch file. Is there a way to maintain, or re-divert focus onto the batch window?
Thanks
EDIT: Got it to do what I wanted. Used foxidrives suggestion to start them minimized but they were still taking focus. So I made a short VBScript to make the cmd window the active window after each call and the combination of the two worked. Thanks!
There is no command to steal the focus. As Bill_Stewart posted, that would be a dangerous feature that grants the program too much power over the user. You can however start the applications minimized (they will still be the active window), and then build and call a VBScript to make your batch window the active window:
start "" /MIN "application.exe"
cscript /nologo myVBScript.vbs
myVBScript.vbs
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.AppActivate "myBatchFile"
WScript.Sleep 2000
WshShell.AppActiavte "myBatchFile"
I've read that several people have had trouble with AppActivate on Windows 7. It was not functioning for me, and instead of bringing my target window to the foreground it just blinked in the task bar. Calling it a second time however, for some reason, brought it to the foreground and made it the active window, which is what I wanted. Hope this helps anybody else with a similar issue.
you can't lock the focus to your command prompt window. But what you could do is to set the TopMost flag of the command prompt window. There is a Win32 function called SetWindowPos which does that. Maybe there are some ready to use command line tools around which are doing this for you. Or, if you have visual studio installed, try to compile this one here: How to set a console application window to be the top most window (C#)?
If you use the start command with the /min switch then the application will be minimised and the batch file should remain visible:
#echo off
pause
echo launching notepad
start "" /min notepad
echo notepad is active
pause

Resources