@Echo OFF
REM ===== Header ====================================
REM == MUST BE AT The Begining of The Batch =========
IF EXIST "%temp%\pos.vbs" goto :Code
CALL :Pos "883" "220" %= [350 350] is X, Y Coordinate =%
EXIT /B
REM ===== Code ======================================
REM == Put All Your Code Down Here ==================
:Code
Echo This is a Test Batch File in 350, 350 Coordinates on the screen
Pause
REM == MUST Delete The Vbscript before Your Batch Ends
DEL /Q "%temp%\Pos.vbs"
Exit /B
REM ===== Position Script============================
:Pos <X_Coordinate> <Y_Coordinate>
REM This Function will take two inputs X and Y Coordinates to Position the CMD window
REM %~dpnx0 in the script will get this batch full path and add it
REM to the vbscript, so the vbscript run the batch in position.
(
Echo Set objWMIService = GetObject^("winmgmts:\\.\root\cimv2"^)
Echo Set objConfig = objWMIService.Get^("Win32_ProcessStartup"^)
Echo objConfig.SpawnInstance_
Echo objConfig.X = %~1
Echo objConfig.Y = %~2
Echo Set objNewProcess = objWMIService.Get^("Win32_Process"^)
Echo intReturn = objNewProcess.Create^("%~dpnx0", Null, objConfig, intProcessID^)
)>"%temp%\pos.vbs"
Start "" "%temp%\pos.vbs"