Erase SET /P Prompt after execution
Moderator: DosItHelp
-
- Posts: 82
- Joined: 24 Apr 2011 19:20
Erase SET /P Prompt after execution
Hello,
Is it possible to erase the SET /P prompt without clearing the entire screen after the execution of the prompt?
Is it possible to erase the SET /P prompt without clearing the entire screen after the execution of the prompt?
Re: Erase SET /P Prompt after execution
I believe aGerman wrote a simple little C++ program that can put chars on the screen at position X,Y. Using this, you could echo spaces over the prompt. I'm sure he's able to whip another program up?
--Phillid
--Phillid
-
- Posts: 16
- Joined: 16 Jul 2010 01:29
Re: Erase SET /P Prompt after execution
is this what you need?
Code: Select all
@echo off
:1
echo 1
SET /P C=[1,2,3]?
for %%? in (1) do if /I "%C%"=="%%?" goto 1
for %%? in (2) do if /I "%C%"=="%%?" goto 2
for %%? in (3) do if /I "%C%"=="%%?" goto 3
echo Incorect Selection
goto 1
:2
echo 2
SET /P C=[1,2,3]?
for %%? in (1) do if /I "%C%"=="%%?" goto 1
for %%? in (2) do if /I "%C%"=="%%?" goto 2
for %%? in (3) do if /I "%C%"=="%%?" goto 3
echo Incorect Selection
goto 2
:3
echo 3
SET /P C=[1,2,3]?
for %%? in (1) do if /I "%C%"=="%%?" goto 1
for %%? in (2) do if /I "%C%"=="%%?" goto 2
for %%? in (3) do if /I "%C%"=="%%?" goto 3
echo Incorect Selection
goto 3
Re: Erase SET /P Prompt after execution
I didn't write it by myself (even if I could).
I found an interesting link:
http://pastebin.com/Em5QLzJJ
BTW: As long as the cursor is on the same line you could use the Carriage Return character as well as the Back Space character. But it's useless in your case.
Regards
aGerman
I found an interesting link:
http://pastebin.com/Em5QLzJJ
BTW: As long as the cursor is on the same line you could use the Carriage Return character as well as the Back Space character. But it's useless in your case.
Regards
aGerman
Re: Erase SET /P Prompt after execution
aGerman wrote:BTW: As long as the cursor is on the same line you could use the Carriage Return character as well as the Back Space character.
Regards
aGerman
I do love that trick but have not found any practical purpose for it other than doing this.
Code: Select all
@echo off
setlocal EnableDelayedExpansion
for /F %%a in ('copy /Z "%~dpnx0" nul') DO set "CR=%%a"
for /l %%I in (0) do (
<nul set /p "=The time now is is !time:~0,-3!!CR!"
ping -n 1 127.0.0.1 > nul
)
Last edited by Squashman on 02 Jan 2012 17:26, edited 1 time in total.
Re: Erase SET /P Prompt after execution
I wrote my own clearchars program. You can find the exe and the source at http://batchbin.ueuo.com/clearchars.zip.
Just use it like this:
I think this is what you are looking for.
Please post any problems you have with it, so I can fix 'em
--Phillid
Just use it like this:
Code: Select all
clearchars [X] [Y] [number of chars]
I think this is what you are looking for.
Please post any problems you have with it, so I can fix 'em
--Phillid
-
- Posts: 82
- Joined: 24 Apr 2011 19:20
Re: Erase SET /P Prompt after execution
phillid wrote:I wrote my own clearchars program. You can find the exe and the source at http://batchbin.ueuo.com/clearchars.zip.
Just use it like this:Code: Select all
clearchars [X] [Y] [number of chars]
I think this is what you are looking for.
Please post any problems you have with it, so I can fix 'em
--Phillid
Hmm... it says that I'm missing a .dll file (libgcc_s_dw2-1.dll) and cannot be run. I am on a 64-bit machine, by the way.
EDIT: I was able to download a copy of it from the Internet and I got it to work. Maybe you can include that .dll with your .zip file.
Re: Erase SET /P Prompt after execution
Ah, yes that DLL is part of the MinGW C/C++ compiler which I use to compile my programs. I will rewrite that program in C tomorrow (it's 10:12 PM where I am) so it doesn't need that DLL and upload it to my site. While this thread is open, I'll mention http://batchbin.ueuo.com/gotoxy.zip which I will rewrite in C too. There should be no need for downloading of any DLLs with these programs once fixed, thanks for that bug report
-
- Expert
- Posts: 442
- Joined: 01 Aug 2010 17:13
- Location: Canadian Pacific
- Contact:
Re: Erase SET /P Prompt after execution
phillid, great! Please note it said libstdc++-6.dll was missing for me with gotoxy, as well as the other DLL for both.
nitt wrote a program here that did a similar job as gotoxy but it relied on .NET. I requested a C(++) version but he was unable...
However, nitt's version I think had one feature, where if you entered negative values for X and Y, it would reposition the cursor backward from it's current position (so, relative as well as the default absolute). It's not necessary, but just take this as a suggestion (for both tools).
I'll be using your next compiled versions. It's safe to say they are freeware?
PS: There's a problem with clearchars, the first argument sets the row (Y), the second argument does nothing and the third determines the number of characters to clear.
Should be like it is in gotoxy?
Also, should clearchars not set the cursor position back to where the cursor started, or at least to the beginning of the position where text was cleared? I think you might've intended it to return, here:
But that just sets the cursor to it's current position which was already changed, so you need to store the starting position in variables, right...?
nitt wrote a program here that did a similar job as gotoxy but it relied on .NET. I requested a C(++) version but he was unable...
However, nitt's version I think had one feature, where if you entered negative values for X and Y, it would reposition the cursor backward from it's current position (so, relative as well as the default absolute). It's not necessary, but just take this as a suggestion (for both tools).
I'll be using your next compiled versions. It's safe to say they are freeware?
PS: There's a problem with clearchars, the first argument sets the row (Y), the second argument does nothing and the third determines the number of characters to clear.
Code: Select all
gotopos(0, atoi(argv[1]));
Should be like it is in gotoxy?
Code: Select all
gotopos(atoi(argv[1]), atoi(argv[2]));
Also, should clearchars not set the cursor position back to where the cursor started, or at least to the beginning of the position where text was cleared? I think you might've intended it to return, here:
Code: Select all
gotopos(cursor.x, cursor.y);
But that just sets the cursor to it's current position which was already changed, so you need to store the starting position in variables, right...?
Re: Erase SET /P Prompt after execution
Orange_batch, thanks for that
I did forget about this thread, but now I'm back on it and I will address all of your comments now:
The case of the missing DLL
This is due to my C++ compiler. I will re-write both programs in C. My C compiler does not say that you need these DLLs.
Relative cursor positions
Great idea! I'll be adding a switch to gotoxy's command line syntax to enable relative cursor positioning.
Freeware?
More than freeware, it's open source. You are absolutely free to dish the programs out to anyone, although I would appreciate an acknowledgement (maybe just 'Thanks, http://batchbin.ueuo.com/') to be stuck your program(s) (maybe the help or about?) somewhere if you are distributing it/them. Great to know someone will use them
Bugs, bugs and more bugs
Thanks for pointing that out, I will have a look at the code tonight. I whacked the first versions of these programs together in about 2 minutes each, so I thought I'd get bug reports back. I will rewrite them in C and do some serious debugging tonight
I'd better get to some programming... I'll build on the website when I can. Maybe giving it a homepage would be a start Look on the site (when I get the homepage made) for updates and news on the programs
--Phillid
I did forget about this thread, but now I'm back on it and I will address all of your comments now:
The case of the missing DLL
This is due to my C++ compiler. I will re-write both programs in C. My C compiler does not say that you need these DLLs.
Relative cursor positions
Great idea! I'll be adding a switch to gotoxy's command line syntax to enable relative cursor positioning.
Freeware?
More than freeware, it's open source. You are absolutely free to dish the programs out to anyone, although I would appreciate an acknowledgement (maybe just 'Thanks, http://batchbin.ueuo.com/') to be stuck your program(s) (maybe the help or about?) somewhere if you are distributing it/them. Great to know someone will use them
Bugs, bugs and more bugs
Thanks for pointing that out, I will have a look at the code tonight. I whacked the first versions of these programs together in about 2 minutes each, so I thought I'd get bug reports back. I will rewrite them in C and do some serious debugging tonight
I'd better get to some programming... I'll build on the website when I can. Maybe giving it a homepage would be a start Look on the site (when I get the homepage made) for updates and news on the programs
--Phillid