Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

User input in DOS batch file - Renaming a text file

Posted on 2004-08-17
9
Medium Priority
?
3,134 Views
Last Modified: 2008-02-01
I am trying to rename a text file inside of a batch file before copying it to a network directory. I am running Caldera DOS. The program is a service program that is called via a single batch file. I can copy output.txt to the network directoy, but would really like to prompt the user for the unit sn and rename output.txt to unitsn.txt before copying it to the network directory.

Any help would be appreciated!

Erik
0
Comment
Question by:ratbert1001
7 Comments
 
LVL 10

Expert Comment

by:For-Soft
ID: 11827972
It is possible to create file and save user input to it, and run it to assign input as variable:
ECHO SET INPUT=>input.bat
TYPE CON>>input.bat
CALL input.bat

User have to use [CTRL] [Z] and then [ENTER] to accept entered data.
Variable %INPUT% will be filled with word entered by user.
0
 
LVL 14

Expert Comment

by:JohnK813
ID: 11831636
You could also try

set /p input=Enter a file name:
move output.txt %input%.txt

For-Soft, please correct me in set /p doesn't work in Caldera DOS
0
 
LVL 10

Expert Comment

by:For-Soft
ID: 11833265
set /p is Microsoft Windows NT/2000 specific. I don't know if it works in Caldera DOS.
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 14

Expert Comment

by:JohnK813
ID: 11833972
Well, it looks like I learned something new today, then.  Thanks.
0
 

Author Comment

by:ratbert1001
ID: 11873796
Neither of these is exactly what I am looking for. Are there any old freeware programs out there that will allow me to do somthing like this?
0
 
LVL 8

Accepted Solution

by:
K_2K earned 800 total points
ID: 11877969
INPUT     String input/editing          ver 1.2 (c) 2001 Horst Schaeffer

http://home.mnet-online.de/horst.muc
0
 
LVL 1

Assisted Solution

by:shanekelly_7
shanekelly_7 earned 800 total points
ID: 11923653
set /p var=Prompt:
set var=%var:~%
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question