I'm looking for a method of interactively renaming a file via batch file.
I don't know if this can even be done, but I would like the batch file to ask the user to imput a new name for the file, the user types it in and presses enter, and the file is renamed with the value that the user typed.
Here's an example:
Assume file test.txt located on the C: drive.
The batch file, when launched, would display "Please type in a new name" (ECHO command). The user would enter a new name and press enter. That string of text would presumably be assigned as a local variable (using SETLOCAL?). Finally, the script would rename test.txt to whatever the user typed.
Any ideas how this could be done?
----- SOLVED ------
SET /P WHATEVER=
REN test.txt "%WHATEVER%.txt"
I don't know if this can even be done, but I would like the batch file to ask the user to imput a new name for the file, the user types it in and presses enter, and the file is renamed with the value that the user typed.
Here's an example:
Assume file test.txt located on the C: drive.
The batch file, when launched, would display "Please type in a new name" (ECHO command). The user would enter a new name and press enter. That string of text would presumably be assigned as a local variable (using SETLOCAL?). Finally, the script would rename test.txt to whatever the user typed.
Any ideas how this could be done?
----- SOLVED ------
SET /P WHATEVER=
REN test.txt "%WHATEVER%.txt"