Jump to content

Batch scripting - Disable X button (Disable Close) ???


Recommended Posts

Does anybody know a way to disable the X on a command prompt window when it is running a batch script..

Is there a simple exe that can do it...

I already use minwin.exe and that minimises the window but unfortunately people are still closing it.

we have a mixed environment with a lot of old NT machines and not all of them run VBS scripts.

The windows 2000 machines and newer all run the script in the background through active directory so they're not a problem.

I was thinking about just writing an AUTOIT script to run the batch file.. Is that the best way?

Link to comment
Share on other sites

Windows XP isn't known for its powerful command line interface. Still, one of the first things I do on any fresh Windows install is set up the "Open Command Window Here" right click menu. And hoary old cmd.exe does have a few tricks up its sleeve that you may not know about.


The first thing you'll want to do is Start, Run, cmd.exe, then right click the window menu and choose properties. Be sure to enable the following quality of life improvements:

Options | Command History | Buffer Size | 500

Options | Command History | Discard Old Duplicates | True

Options | Edit Options | QuickEdit Mode | True

Layout | Screen buffer size | Height | 999

Layout | Window size | Height | 50

Now we've got some room to actually see stuff! QuickEdit mode enables copying from the command prompt by intuitively dragging and right clicking with the mouse. Furthermore, you can paste what's in the clipboard to the command line by right clicking with nothing selected.

And of course, set the font and colors to taste. I use green-screen style colors (background 0 55 0, foreground 0 255 0) with Lucida Console as pictured above. But if you prefer Comic Sans here, be my guest! When exiting this dialog, you'll be prompted to save. Make sure you select "Save properties for future windows with same title" so all future command prompts will benefit from these improved settings.

There are also a few helpful keyboard shortcuts that aren't always widely known:

Pressing arrow up selects a previous command from your command history; similarly, arrow down selects the next command.

Pressing F7 pops up your command history list.

You can drag n' drop files or folders from an explorer window into a command prompt; this inserts the quoted path as if you had manually pasted it.

Tab completion is fully supported; type edit *.ini then hit TAB to iterate through all matches. Use SHIFT+TAB to move to the previous match. This works for partial filenames as you would expect, and in all commands.

Tired of the typical "c:windowssystem32cmd.exe" window title? Change it using the TITLE command.

ALT+ENTER takes your command prompt to fullscreen mode and back again.

If you're really a hard-core cmd.exe junkie (or maybe a UNIX user), you may want to look into the 4nt command shell replacement. It's a direct descendant of the venerable 4dos shell.

Link to comment
Share on other sites

er yeah? I mean thanks and all for the info but I'm still stuck..

I definitely saw on an old NT network before (when I was in High School) the boxes greyed out but I think that was done using POLEDIT and I'm not very good with that.. .to be honest as well on a mixed network I'd prefer not to touch it... But the more I think about it the more I think there's probably no way to do it unless somebody programmed a perfect little EXE... oh well

Link to comment
Share on other sites

Thanks Coop you really helped me here and I appreciate it... I did a lot of googling but got nowhere.

I usually use AUTOIT or AUTOHOTKEY or NIRCMD or FREEBASIC for scripting but NIRCMD is the one I use the least and I had forgotten all about the hide feature..

Thanks again

for anybody that wants to know here's the command line:

NirCMD exec hide "path to batch file"

in my case, it's

"%logonserver%netlogonNirCMD" exec hide "%logonserver%netlogonlocal.bat"

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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