Изменение файла с .txt на .FOR

295
mflo

У меня есть файл .txt, который я хочу превратить в файл .FOR. Я думал, что мог бы просто сделать следующее "test.txt" для "text.FOR" при именовании файла, но это не сработало, так что я могу сделать? Я скачал компилятор Fortran 77 и у меня есть компьютер с Windows 8.

0

3 ответа на вопрос

1
LPChip

By default, in windows, show extensions is set to disabled.

This means that your textfile will have the name: text but in reality this is text.txt.

If you rename text to text.for, or in the save as form, you wrote text.for, in reality this is named as text.for.txt

In a save as dialog, there is always the option to choose the save as type. If you select Show all files (*.*) and you then enter text.for, it will actually save as text.for.

Alternatively, you can enable showing extensions, and it does not matter if you specify the save as type anymore.

To show extensions, open your explorer window and go to the options. Go to the tab View and from the list, find [v] Hide extensions for known filetypes and uncheck it.

0
Fazer87

I am working on the assumption that you couldn't rename the file here - and not that you renamed the file but fortran wouldn't load it.

The most probably cause of this is a hidden file extension. If you save a text file in notepad and then rename it to "myfile.FOR" - windows will try to preserve the file extension, and you actually end up with "myfile.FOR.txt". This is a measure to try and stop users accidentally changing their file extesnions so that windows doesn't know how to open the file (in windows, file extensions are used to determine the application used to open the file)

You should be able to rename the file in one of 2 ways:

Command Line

ren myfile.txt myfile.FOR 

enter image description here


Show File Extensions:

  • In Windows 8.x, choose Desktop. In Windows 10, click the Start button.
  • Open the Control Panel.
  • Choose Folder Options under Appearance and Personalization.
  • Click the Options icon on the right of the ribbon.
  • In the Folder Options dialog box, select the View tab.
  • Select Show hidden files, folders, and drives.
  • Deselect Hide extensions for known file types and click OK.

Now rename your file: enter image description here

0
TOOGAM

Agreement with pre-existing answers

Other answers, like the explanation in LPChip's answer, and the steps in Fazer87's answer, are correct. The "Folder Options" screen shown in Fazer87's answer is quite useful in helping to prevent this problem. Simply uncheck "Hide extensions for known file types". I also like to make some other changes:

  • Display the full path in title bar
  • Show hidden files, folders, and drives
  • Uncheck: Hide empty drives
  • Uncheck: Hide protected operating system files (Recommended)

The reason I make all those other changes is to show details, instead of hide details.

Using quotes

There is another way to handle things, which I think fewer people know about, but which is nice because it is often faster in the short term.

When you save a file, don't save it with the filename of: test

Instead, save it with the filename: "test.txt"

The addition of the quotation marks around the filename will cause Windows to accept the filename you specify, instead of trying to tinker with it (by adding an undesired filename extension).