Jump to content

run batch script with title bar disabled


althurm
 Share

Recommended Posts

Hello all,

I have a batch script that I need to run in a WinPe environment. The script may require some user interaction, so I would like to run it with the title bar of the console removed so that the user has no way of closing/stopping the script midstream (or alternatively the X button greyed out or disabled). Does anyone know how to do this? Maybe by some autoit function?

Link to comment
Share on other sites

Quick and dirty solution.

#include <WinAPI.au3>
Const $GWL_STYLE = -16
Const $WS_POPUP = 0x80880000

$pid = Run("c:tempbat.bat")
$hWnd = WinWait("C:\Windows\System32\cmd.exe")

$style = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE)
_WinAPI_SetWindowLong($hWnd,$GWL_STYLE,BitXOR($style,$WS_POPUP))

Doesn't block Ctrl+C though.

If you really don't want them to stop it you should consider converting the bat into an autoit script.

Edited by spudw2k
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...