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  
Date: Sep 05,2017 at 10: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

1,015 views      
Thread locked
 

Messages in this Thread

 
96,637 Postings in 12,231 Threads, 350 registered users, 74 users online (0 registered, 74 guests)
Index | Admin contact |   Forum Time: Mar 29, 2024 - 6:13 am UTC  |  Hits:62,394,778  (9,564 Today )
RSS Feed