Computing.Net > Forums > Windows XP > Batch File with User Input

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Batch File with User Input

Reply to Message Icon

Name: steigrafx
Date: April 8, 2004 at 12:02:28 Pacific
OS: XP Pro
CPU/Ram: P4 2.4/512MB
Comment:

I'm hoping someone can help me with this minor problem. I wrote a tiny batch file in XP that requires user input. However, if I make a shortcut on the desktop all it does is briefly open and close a command prompt window. This is the batch file I made called ascii.bat:

copy e:\cat4\usr\maryann\%1.v1 a:\*.asc

As you can see, it simply asks the user to provide a file name (with the extension .v1) and copies it to a floppy with the extension .asc (yes, it is a text file -- why the program that creates the text file uses the extension .v1 is beyond me).

Can anyone suggest a way for me to create a shortcut that will open the command prompt window looking like this:

c:\ascii

which simply waits for the user to input the file name and press enter?

Thank you.



Sponsored Link
Ads by Google

Response Number 1
Name: jefro
Date: April 8, 2004 at 14:21:57 Pacific
Reply:

I think it might work with "batch.bat ?"

From rin1010

"This example merely echoes the replaceable parameter to the screen
and then closes the window, but perhaps it will give you some ideas...


::
@echo off
cls
echo.
if "%1"=="" goto usage
echo You entered: %1
goto end
:usage
echo Must enter a valid parameter...
:end
echo.
pause
cls
exit
::
"


0

Response Number 2
Name: jefro
Date: April 8, 2004 at 14:23:25 Pacific
Reply:

To clarify a bit. The ? should be added to the pif command line params. The pif should also be edited for either close on or not.


0

Response Number 3
Name: steigrafx
Date: April 8, 2004 at 17:07:43 Pacific
Reply:

Jefro, thank you so much. I'm going to see if I can adapt your suggestion. The only reason I'm doing this is for my wife, who is not very computer literate. She becomes frustrated when confronted with a directory structure, and of course telephones me at work so I can walk her through it. Hopefully your suggestion will work.

I had one other idea, and that was to write a small Visual Basic app to accomplish the task, only that would require me to learn something new!

Thanks again.

Kevin


0

Response Number 4
Name: Rambler
Date: April 8, 2004 at 17:17:21 Pacific
Reply:

c:
cd c:\ascii
set /p file=Enter filename:
copy e:\cat4\usr\maryann\%file%.v1 a:\%file%.asc

Add a line

pause

if you want to see the results before the window closes. It's a bit more complicated if you want the window to stay open.


0

Response Number 5
Name: steigrafx
Date: April 8, 2004 at 18:41:20 Pacific
Reply:

Rambler, your suggestion worked like a charm. Thank you so much.

And thanks again, Jefro, for all your help.

Kevin


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

accessing doc. from anoth... Damn Boot Problems



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: Batch File with User Input

Create batch file with menu www.computing.net/answers/windows-xp/create-batch-file-with-menu/119742.html

Change prompt with batch file www.computing.net/answers/windows-xp/change-prompt-with-batch-file/147732.html

Defragmenting Using Batch File www.computing.net/answers/windows-xp/defragmenting-using-batch-file/136038.html