start batch file in fullscreen mode - batch-file

How can I start a batch file in full-screen mode? I know that this question was asked before, but it wasn't actually answered.
unfortunately, I don't know reverse engineering, so I cant decompile the code.
Here is something I tested:
#if (#CodeSection == #Batch) #then
#echo off
rem Use %SendKeys% to send keys to the keyboard buffer
set SendKeys=CScript //nologo //E:JScript "%~F0"
start cmd.exe
%sendkeys% "(%{enter})"
goto :EOF
#end
// JScript section
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));
The idea is that it starts a cmd window, and (this part of the code %sendkeys% "(%{enter})") is supposed to simulate the user pressing [alt] + [enter]. But it doesn't work.
I wrote a little c# tool to send an alt+enter to the cmd window, but I'm looking for an internal method.

If sendkeys parameter for "Alt-Enter" should be "%{enter}", then this line:
%sendkeys% "(%{enter})"
... should have not parentheses and there is one percent sign missing. Try:
%sendkeys% "%%{enter}"
See the example for "Alt-V" at this post

I made an autoIT script, extremely simple.
Run("cmd.exe")
sleep (1000)
Send("!{enter}")
Unfortunately, this isn't what I want. I was looking for more of an actual command, not some other 3d party program.
:: edit
here: This is a link to the compiled 1 line skiddy script that I made.
Its a command line tool, so all you have to do is type fullscreen in a cmd window to toggle fullscreen mode.
In case you don't know how to use a command line tool, you have to be in the same directory as the file.

Related

How to merge two batch file into one batch file?

I have two batch files as below, and I want to merge them in to one btach file? (I don't want to run them seperately want to one click to run)
First one delete and copy file, second one is opens chrome and login. These batch files working properly one by one when I clicked. But I need one batch file.
Thanks for your help..
First one is:
#echo off
del "C:\web.config"
copy "C:\\Web - New.config" "C:\web.config"
Second one one is:
#if (#CodeSection == #Batch) #then
#echo off
rem Use %SendKeys% to send keys to the keyboard buffer
set SendKeys=CScript //nologo //E:JScript "%~F0"
START CHROME "http://localhost:15000/"
rem the script only works if the application in question is the active window. Set a
timer to wait for it to load!
timeout /t 2
rem use the tab key to move the cursor to the login and password inputs. Most htmls
interact nicely with the tab key being pressed to access quick links.
rem %SendKeys% "{TAB}"
rem now you can have it send the actual username/password to input box
%SendKeys% "admin"
%SendKeys% "{TAB}"
%SendKeys% "1234"
%SendKeys% "{ENTER}"
goto :EOF
#end
// JScript section
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));
When you have two batchfiles, batch1.bat and batch2.bat and you want both of them to run in one batchfile, the simpliest solution is to create this batchfile:
call batch1.bat
call batch2.bat
There's absolutely no problem running a batchfile from another batchfile!

How do you make a batch file that opens an exe but also "clicks" the run button in that exe?

I can get the batch file to open it, but I don't know how to get it to execute the "Run Test" button. Whats the command line for this?
Updating my answer, I think tabs are best without being able to see what your windows with the button looks like. {Tab 6} here just needs to be changed. When you open the EXE with the "Run Test" button, just hit tab until you are focused on the "Run Test" button. Count the number of times you hit tab, then change the "6" in my code to that number.
#if (#CodeSection == #Batch) #then
#echo off
set SendKeys=CScript //nologo //E:JScript "%~F0"
start notepad
timeout /t 3
%SendKeys% ("{tab 6}{enter}")
goto :EOF
#end
// JScript section
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));

Keypress simulation with Batch-JScript duo not working as expected

After doing some googling I got many answers(from stackoverflow and other sites) saying keypress automation & simulation is possible with Batch-JScript duo file, so I put together my fndings and made a script like below, but it doesn't work as expected at all.
Take a look at the below script:
#if (#CodeSection == #Batch) #then
#echo off
set SendKeys=CScript //nologo //E:JScript "%~F0"
start SystemPropertiesAdvanced.exe
%SendKeys% "{n}"
goto :EOF
#end
::JScript section
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));
As it is apparent from the code, I a trying open the Environment Variables section which is already elevated to Administrator rights, so that user can edit both User and System environment variables. But this script only opens the Window before Environment Variables in elevated privilege.
As you can see, I have already put the code to simulate & automate keypress of n letter after opening the SystemPropertiesAdvanced Window and thus bypassing that manual step, but this part doesn't work.
Maybe I have made some mistake, but I cannot find what would that be, so any help is appreciated.

Send Command to Bluetooth Serial using Putty/Plink

I have searchewd a few posts here, but I cannot find one that is exactly what I am looking for. In simple terms I am trying to send a character to my Arduino via bluetooth Automatically.
I have tried both Putty and Plink, but neither work automatically. Here is the commands I have tried so far:
command.bat | putty -serial com3 -sercfg 9600
Command.bat:
#echo off
timeout /t 5
echo 2
and
plink -load Arduino echo 2
This connects to the bluetooth adapter on the Arduino, but opens an Interactive console. I can hit the number 2 on the keyboard it is sends it correctly. However I want that to be sent automatically. I have timeout in there because it takes a few seconds to connect to the bluetooth.
Is there a way to do this so I can just run a bat file and have it send the commands automatically?
If the interactive console opens up and is the most present item, you can use the following code upon the interactive console startup...
#if (#CodeSection == #Batch) #then
#echo off
set SendKeys=CScript //nologo //E:JScript "%~F0"
rem wait for interactive console to appear before pressing 2 to initialize
timeout /t 5
%SendKeys% "{2}"
goto :EOF
#end
// JScript section
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));
Call it a cheap fix if you will, the code will call a javascript to press 2 for you. Im not sure how to tie it with your absolute program but this will run it automatically as the computer will simulate the input for you.

how to launch an application from a batch file without giving it focus (windows 7)

i have a batch file with a for loop, in which i launch my application repeatedly (the app terminates by itself). i am using:
start /wait /min myapp
in order to have it run minimized and wait for self-termination.
my problem is that the application steals window focus each time it is run.
how can i launch the app without giving it focus?
You could use a Batch/JScript hybrid, so you can use the WScript.Run method.
With the second parameter =7 you got it.
7=(Displays the window as a minimized window. The active window remains active.).
MSDN Run Method
#if (#X)==(#Y) #goto :Dummy #end/* Batch part
#echo off
setlocal
cscript //nologo //e:jscript "%~f0"
goto :eof
Jscript part begins here */
var sh=new ActiveXObject("WScript.Shell");
sh.Run("cmd /c wait.bat",7,true)
sh.Run("cmd /c wait.bat",7,true)
The wait.bat
ping -n 5 127.0.0.1
my app is a c# form and the problem was having topmost = true

Resources