1
@echo off
timeout /t 2 >NUL 
cls
cd %temp%
set "var1=%random%%random%"
 echo >%var1%.vbs set shell = CreateObject("WScript.Shell"):shell.SendKeys "%{ENTER}" & %var1%.vbs
pause

This is my code. What I basically want the batch file to do is to open itself up in fully, fully fullscreen (im talking f11 fullscreen mode). You can fullscreen a batch file on windows 10 with ALT+ENTER. So I write vbs send keys to do that... The % and ENTER is to send ALT+ENTER... when ran, I don't get an error with the vbs... just no fullscreen... why?

oh no
  • 118
  • 6
  • 1
    maybe [this helps?](https://stackoverflow.com/questions/3824284/how-can-i-maximize-restore-or-minimize-a-window-with-a-vb-script) – Stephan Sep 05 '20 at 09:58
  • 1
    I believe you need to [escape](https://ss64.com/nt/syntax-esc.html) the `%`-sign in `%{ENTER}` like `%%{ENTER}`… – aschipfl Sep 05 '20 at 10:05
  • The double escape sign still doesn't work for some reason. – oh no Sep 05 '20 at 19:32
  • Stephan, batch/cmd has ALT+ENTER for fullscreen. I'm not talking about maximized, i'm talking fullscreen. – oh no Sep 05 '20 at 19:34
  • I found the solution. ```echo >%var1%.vbs set shell = CreateObject("WScript.Shell"):shell.SendKeys "{F11}" & %var1%.vbs``` – oh no Sep 05 '20 at 19:43
  • another thing: in windows 10, if you look closely while fullscreening batch using `ALT+ENTER` or `F11` you can see some type of windows 7/vista minimize and maximize buttons. weird. – oh no Sep 05 '20 at 19:45

1 Answers1

1

I created this batch and i tested it on my Windows 10 and it works 5/5


@echo off
Set "MyTitle=FullScreen"
Title %MyTitle% & color 0A & cls & cd %temp%
set "vbsfile=%~n0.vbs"
echo >"%vbsfile%" set shell = CreateObject("WScript.Shell"):shell.SendKeys "{F11}"
REM Timeout /t 1 /nobreak>NUL
Wscript.exe "%vbsfile%"
Ipconfig /all
pause

And here is another batch that can use this as sub to be called when you want to fullscreen or come to the back to normal screen :


@echo off
REM Here we call the sub :FullScreen to make it fullscreen
Call :FullScreen
Ping www.google.com
Tracert www.google.com
Call :FullScreen REM You come to the normal when we call it again the sub :FullScreen
ipconfig /all
Pause & Exit
REM -------------------------------------------------------------------------------
:FullScreen
Set "MyTitle=FullScreen"
Title %MyTitle% & color 0A & cls & cd %temp%
set "vbsfile=%~n0.vbs"
echo >"%vbsfile%" set shell = CreateObject("WScript.Shell"):shell.SendKeys "{F11}"
REM Timeout /t 1 /nobreak>NUL
Wscript.exe "%vbsfile%"
Exit /b
REM -------------------------------------------------------------------------------
Hackoo
  • 18,337
  • 3
  • 40
  • 70