Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
StrToFile to create a batch file... Win98 & W2k differences
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
StrToFile to create a batch file... Win98 & W2k differences
Divers
Thread ID:
00883093
Message ID:
00883093
Vues:
52
I am using the following to create a batch file whose purpose is to force jpg filenames to lowercase (for ftp'ing to a unix webserver):
ERASE c:\lowercasenames.bat
cPath = "C:\temp\"

ADIR(aFiles,"c:\temp\*.JPG")
IF TYPE("aFiles") = "C"
  FOR nCnt = 1 TO ALEN(aFiles,1)
    cText = "rename " + cPath + ALLTRIM(aFiles(nCnt,1)) +" " + LOWER(ALLTRIM(aFiles(nCnt,1)))+CHR(10)
    STRTOFILE(cText,"C:\lowercasenames.bat",.t.)
  ENDFOR
ENDIF
IF FILE("c:\lowercasenames.bat")
   RUN /N7 C:\lowercasenames.bat
ENDIF
The batch file looks like:
rename C:\temp\TEJAS1.JPG tejas1.jpg
rename C:\temp\TEJAS2.JPG tejas2.jpg
rename C:\temp\TEJAS3.JPG tejas3.jpg
rename C:\temp\TEJAS4.JPG tejas4.jpg
rename C:\temp\TEJAS5.JPG tejas5.jpg
What you cant see in the bat file listing above is that there is a blank line at the end of the file... from the CHR(10).

Running this batch file on a W2K box, it runs fine. Running it on a Win98 box, the last line is apparently a problem and no renaming takes place. I would think that each RENAME commandline is processed as it goes, but that does not appear to be the case. If i EDIT the bat file via the DOS prompt and remove the last line, save and run it, it runs fine. I am gunna strip out the last line, but why the difference between the different OS's?
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform