close command prompt

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

Post Reply
User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1241
Joined: 2005 Oct 16, 19:09

close command prompt

Post by FrizzleFry »

Just add an exit after the :end label and the script will close the command prompt when it ends.

Edit: I changed the topic subject since we got split off the original thread.
Last edited by FrizzleFry on 2007 Jun 15, 23:50, edited 2 times in total.
User avatar
JRz
Gold Member
Gold Member
Posts: 560
Joined: 2003 Jun 10, 23:19
Location: NL

Post by JRz »

FrizzleFry wrote:Just add an exit after the :end label and the script will close the command prompt when it ends.
no it won't :)
Dumb questions are the ones that are never asked :turn:
User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1241
Joined: 2005 Oct 16, 19:09

Post by FrizzleFry »

JRz wrote:
FrizzleFry wrote:Just add an exit after the :end label and the script will close the command prompt when it ends.
no it won't :)
It will exit if you are not using x2's console. This is one of the several reasons that I do not use it.
User avatar
JRz
Gold Member
Gold Member
Posts: 560
Joined: 2003 Jun 10, 23:19
Location: NL

Post by JRz »

Hmm, normally it would, but on my system it won't. Even without the Exit it would have to close the command prompt when the script ends. Only if you have specified a custom preamble (szDosCmdPreamble in registry) it could behave differently.

I'll investigate at home (where I ran the script, currently at work) and let you know.
Dumb questions are the ones that are never asked :turn:
User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1241
Joined: 2005 Oct 16, 19:09

Post by FrizzleFry »

Hmm... my point is that if you end the batch/script file with an exit the command prompt will close when you run the script from x2's address/command bar. If you do not have an exit command the script will complete but the command prompt window will remain open.

This does not apply if you are redirecting DOS commands to x2's console.

This is my current preamble:

"szDosCmdPreamble"="cmd.exe /K "

I have adjusted this before to run 4nt instead of cmd but I think this is the standard x2 setting.
User avatar
JRz
Gold Member
Gold Member
Posts: 560
Joined: 2003 Jun 10, 23:19
Location: NL

Post by JRz »

My bad. I had a command in the "szDosCmdPreamble" which was no longer on my system. So when a 'normal' command prompt was started by X², it generated an error.

Strangely enough it did create the folders, but didn't execute the exit at the end of the script.

Normally I do have the X² DOS window enabled, so I didn't notice this quirk on my system until now.

Case closed AFAIC :)
Dumb questions are the ones that are never asked :turn:
User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1241
Joined: 2005 Oct 16, 19:09

Post by FrizzleFry »

If you change the preamble to

"cmd.exe /c "

the command prompt exits automatically even without adding the exit to scripts.

But will this cause problems for the x2 console?
Post Reply