Page 1 of 1 1
Topic Options
#29307 - 2002-09-19 04:27 PM Batch file problem
Kathy Offline
Getting the hang of it

Registered: 2002-09-09
Posts: 96
Loc: Marshall, TX
Win2k Servers
Win 98 Workstations
Kixtart v 4.11

I have a batch file that runs from a registry setting on the user's local drive. It runs great but the DOS window is left open and the usre has to close it. Anyone know why?

Batch code below:
code:
@Echo OFF
Copy "\\server\netlogon\shortcuts\dodahh.lnk" "C:\Windows\Desktop"
Exit 0

_________________________
Stupid is forever - Ignorance can be fixed.

Top
#29308 - 2002-09-19 04:31 PM Re: Batch file problem
Kathy Offline
Getting the hang of it

Registered: 2002-09-09
Posts: 96
Loc: Marshall, TX
I found the answer. Put CLS right after the @Echo Off.
_________________________
Stupid is forever - Ignorance can be fixed.

Top
#29309 - 2002-09-19 04:55 PM Re: Batch file problem
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You shoudl actually suppress any console putput like:
code:
@ECHO OFF
CLS
COPY '\\server\netlogon\shortcuts\dodahh.lnk' 'C:\Windows\Desktop' >NUL
EXIT 0

_________________________
There are two types of vessels, submarines and targets.

Top
#29310 - 2002-09-19 05:31 PM Re: Batch file problem
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Whoa... [Confused]

Clearing the screen at the top results in the window closing??

Just a note -- redirecting output to NUL suppresses only non-critical console messages.
_________________________
We all live in a Yellow Subroutine...

Top
#29311 - 2002-09-19 05:50 PM Re: Batch file problem
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
For a FAQ on redirecting STDERR as well, see:

Topic: Not quite everything you wanted to know about RUN and SHELL
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#29312 - 2002-09-19 06:14 PM Re: Batch file problem
Kathy Offline
Getting the hang of it

Registered: 2002-09-09
Posts: 96
Loc: Marshall, TX
I moved the CLS to the last of the .bat. Works fine.
_________________________
Stupid is forever - Ignorance can be fixed.

Top
#29313 - 2002-09-19 06:43 PM Re: Batch file problem
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Thanks, Les...
According to that info, this
code:
COPY '\\server\netlogon\shortcuts\dodahh.lnk' 'C:\Windows\Desktop' >NUL

could be 'bullet-proofed' as this
code:
COPY '\\server\netlogon\shortcuts\dodahh.lnk' 'C:\Windows\Desktop' 1> NUL 2> NUL

_________________________
We all live in a Yellow Subroutine...

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2375 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.053 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org