|
|
|
Batch Programming Help!
|
Original Message
|
Name: mander04
Date: January 31, 2008 at 05:28:02 Pacific
Subject: Batch Programming Help!OS: xpCPU/Ram: 1 gigModel/Manufacturer: ibm |
Comment: I need to look in a folder and rename a randomly named file with the extension .ls to temp.ls It will be the only .ls file in the folder. I then want to execute a program that will encode the file. It will change the file name to temp.tp. I then want to change the file name back to the original name with the .tp file extension. I need help with the file name manipulation. Please help! Mark.
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: Mechanix2Go
Date: January 31, 2008 at 05:43:45 Pacific
|
Reply: (edit)@echo off > c:\files\my.ls setLocal EnableDelayedExpansion pushd c:\files for /f "tokens=* delims= " %%a in ('dir/b *.ls') do ( set FN=%%~Na ) echo ren !FN!.ls temp.ls echo someprog.exe temp.ls echo ren temp.tp !FN!.tp
===================================== If at first you don't succeed, you're about average.M2
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: mander04
Date: January 31, 2008 at 06:51:09 Pacific
|
Reply: (edit)I must be doing something wrong. My file is stored in c:\fanuc\temp The line for /f.... isn't taking the file name and putting it into !FN!.
Report Offensive Follow Up For Removal
|
|
Response Number 3
|
Name: Mechanix2Go
Date: January 31, 2008 at 07:17:26 Pacific
|
Reply: (edit) @echo off setLocal EnableDelayedExpansionpushd c:\fanuc\temp for /f "tokens=* delims= " %%a in ('dir/b *.ls') do ( set FN=%%~Na ) echo ren !FN!.ls temp.ls echo someprog.exe temp.ls echo ren temp.tp !FN!.tp
===================================== If at first you don't succeed, you're about average.M2
Report Offensive Follow Up For Removal
|
|
Response Number 7
|
Name: mander04
Date: January 31, 2008 at 08:41:35 Pacific
|
Reply: (edit)When I run the following line: For /f "tokens... It replies that The system cannot find the file specified I assume this is what you were thinking, and thats why you had me do the dir/b
Report Offensive Follow Up For Removal
|
|
Response Number 12
|
Name: Mechanix2Go
Date: February 1, 2008 at 16:27:15 Pacific
|
Reply: (edit)That has nothing to do with this. You need to start a new thread. ===================================== If at first you don't succeed, you're about average.M2
Report Offensive Follow Up For Removal
|
Use following form to reply to current message:
|
|

|