Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch file leaves open window 2

Status
Not open for further replies.

jc64

MIS
Nov 9, 2001
43
0
0
US
I have created a batch file to run an application on my Citrix MF 1.8 server. (becuase sometimes the drives don't always map). So I created a batch file called doit.bat with this in it:

@echo off
@echo off
net use r: \\server1\projects$ /persistent:no
cd C:\Program*\application\bin
application.exe
exit
exit

It runs ok, but it leaves a command line window open, regardless of how many exit statements I use at the end. Any suggestions on how to minimize the window or close the open window?
 
Hi!

Work around this by typing

start application.exe

This will start application.exe in it's own window and kill the command windows.

Good luck!

//Chris
 
You could also enhance things by doing this when you run the published app

%systemroot%\system32\cmd.exe /c " start /min \\source\sharename\file.bat

start /min helps alot.

using a UNC path name for the batch file helps. you can then map your drive in the batch file (which you already do)

you've also got the @echo off & exit statements in so you are in good shape.
 
Are we sure the mapped drive will remain available to the application?
I'm sure we've tried something similar and had to use '/Persitent:Yes'
This then caused issues with drives being available when running other applications. BJJJB
"Murphy was an optimist"
 
You could also use runh.exe to hide the batch file (easily found via google) but this may also hide the application you're launching from the batch file too. I don't think it does, but not 100% sure.

Otherwise, call a small kix script that contains the line:
SetConsole("hide")
which'll (unsuprisingly) hide the console that it was called from.

HTH
 
Start /b app.exe

Starts an application in a new window and continues with your script so that you only then need a single "exit".

Cheers,
Carl.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top