This is actually rather common. Just wrap the file opening, matlab logic, and file saving into a function, i.e.
function out = myfunction(inFile, saveFile)
fid = fopen(inFile, 'rt'); %open your text file for reading
%do matlab stuff here
fid2 = fopen(saveFile, 'wt'); %open save file for writing
fwrite(fid2, ... %or however else you are writing your save file
fclose(fid); fclose(fid2); %close your files.
Then you can just call your function from the command prompt as:
myfunction('myfile1.txt', 'outfile1.txt');
myfunction('myfile2.txt', 'outfile2.txt');
You can even wrap the call to myfunction() in a loop to loop through a bunch of files. See http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F