ZTree.com  | ZEN  | About...  

 Index   Back

[Q] a window created by REM #ZTSTART "" doesnt get closed by :EOF? normal?   [Q]

By: Nick Williams     West Sussex, England (forum time +5 hrs)  
Date: Sep 05,2017 at 06:38
In Response to: [Q] a window created by REM #ZTSTART "" doesnt get closed by :EOF? normal? (Ryan)

> AA=
> REM #ZTSTART ""
> ECHO FFFFFFFFFFFFFFF
> GOTO :EOF
> PAUSE
> REM #ZTEXIT
>
>
> what is the nature of :EOF? compared to when a script run meets the end
> of lines.
>
> the window created by REM #ZTSTART "" in AA= doesnt get closed, when
> GOTO :EOF is carried out. i had to remove :EOF's and replace in all my
> ztreemenu.

Hi Ryan,

Some notes that might help you:-

(1) I've never used #ZTSTART, but I believe it passes on parameters and invokes the Cmd Prompt START command. The START command I have used extensively. It launches an asynchronous process which is then independent of the parent process. At a Cmd Prompt, type START /? for more details.

(2) GOTO :EOF causes execution to jump to the logical "End-Of-File". This isn't always the same as the physical "End-Of-File" (depending on whether CALL was used to invoke code execution), but in your example above, the logical EOF is the same as the physical EOF.

(3) In AA=, you have GOTO :EOF on the 3rd line. These means that the following commands, PAUSE and REM #ZTEXIT never get executed. (I think you are using REM #ZTEXIT to EXIT out of whole script, yes ?)

(4) Tip: Use EXIT /B n instead of GOTO :EOF. They do the same job, but with EXIT /B n you can specify an ERRORLEVEL to return to the calling process, e.g. EXIT /B 1 will return ERRORLEVEL 1.

Hope that helps.


Kind regards
Nick

358 views      
Thread locked
 

Messages in this Thread

 
94,593 Postings in 11,933 Threads, 348 registered users, 20 users online (0 registered, 20 guests)
Index | Admin contact |   Forum Time: Nov 22, 2019 - 2:24 am EST  |  Hits:29,228,417  (3,095 Today )
RSS Feed