[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3141
  • Last Modified:

User input in DOS batch file - Renaming a text file

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
ratbert1001
Asked:
ratbert1001
2 Solutions
 
For-SoftCommented:
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
 
JohnK813Commented:
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
 
For-SoftCommented:
set /p is Microsoft Windows NT/2000 specific. I don't know if it works in Caldera DOS.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
JohnK813Commented:
Well, it looks like I learned something new today, then.  Thanks.
0
 
ratbert1001Author Commented:
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
 
K_2KCommented:
INPUT     String input/editing          ver 1.2 (c) 2001 Horst Schaeffer

http://home.mnet-online.de/horst.muc
0
 
shanekelly_7Commented:
set /p var=Prompt:
set var=%var:~%
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now