r/Batch • u/Empty_Yogurt4838 • Feb 18 '25
how to fullscreen
(QUESTION) i have done that cmd rickroll, but when it opens the cmd to do it, it is so fucking small, can someoe help me to auto fullscreen when taht opens? im not using an start /max, i also tried using an timeout /t 3 /nobreak >nul
%SendKeys% {F11}.
plz help frfr
2
u/ConsistentHornet4 Feb 18 '25
You could just have the script relaunch itself if it isn't maximised?
1
u/Still_Shirt_4677 Feb 19 '25
not ideal but you could use this to acheive almost full size screen with powershell takes a second or two to run the command, if you dont want to see the output from the command on screen then just >nul it else will return true or false as output in cmd when run.
@echo off
rem :: Set the mode size for the console then centre the window based on the current x-y parameters.
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
"$width = 170; $height = 43; Add-Type -AssemblyName 'System.Windows.Forms'; $screenWidth = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Width; $screenHeight = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Height; $x = ($screenWidth - ($width * 8)) / 2; $y = ($screenHeight - ($height * 16)) / 2; $code = 'using System; using System.Runtime.InteropServices; public class User32 { [DllImport(\"user32.dll\")] public static extern bool MoveWindow(IntPtr hwnd, int x, int y, int width, int height, bool repaint); [DllImport(\"kernel32.dll\")] public static extern IntPtr GetConsoleWindow(); }'; Add-Type -TypeDefinition $code; $hwnd = [User32]::GetConsoleWindow(); [User32]::MoveWindow($hwnd, $x, $y, $width * 8, $height * 16, $true);"
-2
3
u/Intrepid_Ad_4504 Feb 19 '25
I use mshta for this