Discussion Locked

How to make a command window invisible t

0 helpful
27 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
When any program is run from the command prompt, the command window is visible to the users. I want to run a program which only runs from the command prompt. I have placed it in the startup folder os all users under windows NT. The program runs but it is visible to the user. The user can close it at any time. I want the program to run in the background but it should be invisble to the users i.e. it should not appear on the task bar or on the desktop. Any bright ideas to help me out?

27 replies

by baird_k

Run the cmd with a switch /c. That will terminate the dos prompt. For example:

cmd /c dir

KB

by felixenescu

The solution is to use a wrapper utility to
launch your program.
I can send you binaries of two programs
but maybe you prefer a source code.

If you have acces to a C compiler use the
following code:

-------- CUT -------

#include
#include

int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;

char prog[] = "my_prog.exe";

WinExec(prog, SW_HIDE);

return (msg.wParam);
}

-------- CUT -------

The unhide program is a little longer.
I'll send it to you if you want.

Also search :
http://www.nettally.com/waldoe/freeware/winutil.html
for window.zip

by baird_k

By the way...I assumed that you were running on Windows NT. To make the script a little cleaner run:

%comspec% /c "program"

That will allow the .bat or .cmd file to run on '98, '95 or NT.

KB

by green lantern

In a straight scripting environment, you can't hide the CMD window from your users. You can launch it minimized by using the "start /m" command. This will put it in the systray at the bottom of the screen.

All other methods of hiding the CMD prompt require writing a program to accomplish what you want to do.

by mrshawng

Have the Schedule Service launch the program, and set it not to be Interactive. However, you must configure the Schedule service on each system properly. You'll also have to get an exe called soon.exe, from the resource kit. SOON is similar to the AT command, except that you don't have to specify a time, it automatically executes the command line in five seconds. Example "soon C:\myscript.bat" would launch myscript.bat in 5 seconds, and would not be interactive, therefore not visible to any users.

Hope this is what you wanted.

by blafle

Run the program as a service, you can do this with the util that comes with NT resource kit.

by paul_beauvais

I agree running it as a service is probably the easiest way. run it with a user account with the minumum rights neccessary and do not allow it to interact with the dest top.

by rotocron

If what your running is a login script, then thier a policy item you can check. In the Policy file, you can tell the OS to run the login script before the shell loads. And if you are using Kixtart, one of the commands dis-ables the 'close' or 'X' button when the script runs.

by gicu artistu'

You can use the schedule service which can run a batch file on the console process and the window used is invisible. You can run your console process by inserting the proper command in the batch file
Luck

by green lantern

While this addresses the login script specifically, you should be able to modify the idea to work for you:

Create a batch file that calls the actual logon script. Using Notepad, create a
file that has the following entry:

START /MIN LOGON.BAT

Save the batch file and specify this file as the logon script name for the user accounts in User Manager for Domains. Now, when the users log on to Windows NT, they will initially run the above batch file, which, in turn, calls the logon script and starts it minimized. The last entry in the real logon script file must be EXIT so the file will close properly.

This works great and solves the problem of users seeing the commands being
processed in the actual logon script.

Also, theinitial call to the logon script designated in User Manager for Domains
still creates a logon dialog box. The box disappears almost immediately, but may
still cause a problem for the administrator who does not want the user to see
anything out ofthe ordinary when lo

by uknow

Use Windows NT Resource Kit:
SRVANY.exe utility can be used.
Try running a application as a NT service.

Everytime you start NT you can have your
Command Shell program run invisible to user.

by allen_swain

Within the NT Resource kit, there is a utility that enables you to run a program as a service. This will be transparent to your users, and you can monitor the service via Server manager, then services to ensure that it is running on their PC.

hope this helps,

Allen Swain, MCSE

This discussion is closed to new replies.