Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi
I need to rename multiple files with a *.xls extension into file names which have a sequential number. E.g.
tony.xls --> 1.xls
paul.xls --> 2.xls
mary.xls --> 3.xls
robert.xls --> 4.xls
.
.
.I found a solution from an earlier posting which works under winXP but it doesn't work under winNT, original code as follows:-
@echo off
if "%1"=="GoTo" goto %2
%comspec% /v:on /c %0 GoTo start
goto eof
:start
echo This program will sequencially rename all files with .XLS
echo extention from the current directory, which is:
echo %CD%
echo.
echo This process is not reversible.
echo.
set input=
:input
set /P input=Do you wish to continue [Y/N]?
if /I "%input%"=="Y" goto proceed
if /I "%input%"=="N" goto eof
goto input
:proceed
set N=0
for %%F in (*.XLS) do (
set /A N += 1
ren "%%F" !N!%%~xF
)
:eofWould be greatful if anyone can tell me what to change in the above code to make it work under Windows NT Dos.
Thanks

Stated a batch script designed for XP should work fine equally under NT or 2K, being all NT-kernel based environments, I prefer to give you a more straight script to accomplish your job:
@Echo Off
:: RXLS.BAT Syntax: RXls Folder_NameEcho.
If not exist %~f1.\*.xls (Echo no .xls files found in %~f1 & GoTo :EOF)Set Count=0
For %%A in (%~f1.\*.xls) Do Call :REN %%A
Set Count=
GoTo :EOF:REN
Set /A Count=%Count%+1
Ren "%*" %Count%.xls
Echo Ren "%*" %Count%.xls
GoTo :EOFTo run type Rxls Folder_Name, i.e. Rxls C:\MyFolder or, if the folder is the current one, just Rxls . (dot).
Beware the files are renamed in the order they are retrieved in the directory and the process is NOT reversible.

I've tried your solution however for some reason it still doesn't work with WinNT. When executed it says file or path not found. Any other ideas?

Sorry, I have tested again carefully my script under either Windows 2000 Professional and Windows XP Home SP1 and it works fine. I run a lot of test games including read only attribute files and folders and no problem stems out. The same expressing folders' name as MyFolder\ and so on... Actually I have no NT environment on hand and after all NT/4.0 should not present a different behavior from 2K/XP.
So... what is happening in your system is out of my knowledge.

![]() |
![]() |
![]() |

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