Solved

User input in DOS batch file - Renaming a text file

Posted on 2004-08-17
9
3,114 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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 200 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 200 total points
ID: 11923653
set /p var=Prompt:
set var=%var:~%
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Data copy batch script 21 63
Batch File to Prevent Launch of Another File Based on Date 14 104
robocopy 6 70
DOS Command to remove CR/LF to have one id and one text per line 13 66
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

756 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