How to change a file extension.

I want to know if I can change a file extension of a program. Instead of the program saying .exe I want it to say something else. Now I know that I can change the file etension through DOS, but it causes the program to not work. I want the program to work and have a different extension. Is this is possible could anyone show me how its done.

--Digga

«1

Comments

  • : I want to know if I can change a file extension of a program. Instead of the program saying .exe I want it to say something else. Now I know that I can change the file etension through DOS, but it causes the program to not work. I want the program to work and have a different extension. Is this is possible could anyone show me how its done.
    :
    : --Digga
    :
    :
    As I know it's not possible.

    If you change the extension to .com or
    some other executable exctension and
    convert the file to the propper format
    it should work.

    [b]Niklas Ulvinge[/b] [white]aka [b]IDK[/b][/white]

  • [b][red]This message was edited by stober at 2005-7-2 16:33:14[/red][/b][hr]
    : : I want to know if I can change a file extension of a program. Instead of the program saying .exe I want it to say something else. Now I know that I can change the file etension through DOS, but it causes the program to not work. I want the program to work and have a different extension. Is this is possible could anyone show me how its done.
    : :
    : : --Digga
    : :
    : :
    : As I know it's not possible.
    :
    : If you change the extension to .com or
    : some other executable exctension and
    : convert the file to the propper format
    : it should work.
    :
    : [b]Niklas Ulvinge[/b] [white]aka [b]IDK[/b][/white]
    :
    :


    You can name it any extension you want. If the file does not have one of the standard extensions you have to speify the extension when you want to execute the program. Its not necessary to change the file format.


    executing the program doesn't seem to work with CreateProcess() win32 api function. But the system() function works as well as executing it directly from a command prompt.

  • So how do I change the file extension to whatever I want without changing the format of the file?
  • [b][red]This message was edited by stober at 2005-7-2 15:55:32[/red][/b][hr]
    : So how do I change the file extension to whatever I want without changing the format of the file?
    :

    just rename it. There are several ways to do that.
    1. use Windows explorer to rename the file

    2. use MS-DOS proompt
    [code]
    c:>ren myfile.exe myfile.aaa
    [/code]

    3. to do that with c program
    [code]
    rename("myfile.exe","myfile.aaa");
    [/code]


    There are several other ways too.
  • I can get it to rename the program extension but it does not allow the program to run. If you give it a common extension like .doc or .txt it runs it as a word document or text file. I'm renaming the program extensiom to another name. Which works. but the program does not run and the icon changes. So is this something that can be programmed in or is this impossiable because windows does not like it when people fool around with extension.

    Digga
  • : I can get it to rename the program extension but it does not allow the program to run. If you give it a common extension like .doc or .txt it runs it as a word document or text file. I'm renaming the program extensiom to another name. Which works. but the program does not run and the icon changes. So is this something that can be programmed in or is this impossiable because windows does not like it when people fool around with extension.
    :
    : Digga
    :

    my previous post told you how to do it. in c program use system() function, or execute it manually from the command-line. I was not able to execute it by using windows explorer.
  • : I want to know if I can change a file extension of a program. Instead of the program saying .exe I want it to say something else. Now I know that I can change the file etension through DOS, but it causes the program to not work. I want the program to work and have a different extension. Is this is possible could anyone show me how its done.
    :
    : --Digga
    :
    :
    [green]
    Your OS uses the file extension to determine how and where to read the PSP header in your executable. If you rename the file then the OS will assume that it is not an executable and not run it.
    [/green]


  • : : I want to know if I can change a file extension of a program. Instead of the program saying .exe I want it to say something else. Now I know that I can change the file etension through DOS, but it causes the program to not work. I want the program to work and have a different extension. Is this is possible could anyone show me how its done.
    : :
    : : --Digga
    : :
    : :
    : [green]
    : Your OS uses the file extension to determine how and where to read the PSP header in your executable. If you rename the file then the OS will assume that it is not an executable and not run it.
    : [/green]
    :

    maybe. please read my previous posts.
    :

  • : : : I want to know if I can change a file extension of a program. Instead of the program saying .exe I want it to say something else. Now I know that I can change the file etension through DOS, but it causes the program to not work. I want the program to work and have a different extension. Is this is possible could anyone show me how its done.
    : : :
    : : : --Digga
    : : :
    : : :
    : : [green]
    : : Your OS uses the file extension to determine how and where to read the PSP header in your executable. If you rename the file then the OS will assume that it is not an executable and not run it.
    : : [/green]
    : :
    :
    : maybe. please read my previous posts.
    : :
    :
    :
    [green]
    I know you can rename a file but to execute it with the new file extension should fail since the PSP isn't being translated by the OS. If the OS doesn't know what kind of executable it is from some of the basic types like PE, MZ, COM, ect. then how would it know how to read the PSP? Is there a function in the Winapi that could execute the code by calling the renamed program? I would be curious to know of such.
    [/green]


  • : I want to know if I can change a file extension of a program. Instead of the program saying .exe I want it to say something else. Now I know that I can change the file etension through DOS, but it causes the program to not work. I want the program to work and have a different extension. Is this is possible could anyone show me how its done.
    :
    : --Digga
    :
    :


    The rename through widows works, it just depends on what you are doing. You can change a .txt to a .doc. or a .exe to a .com. But you can't change a txt file to a exe file and stuff like that. What exactly is it you are doing?
  • : [green]
    : I know you can rename a file but to execute it with the new file extension should fail since the PSP isn't being translated by the OS. If the OS doesn't know what kind of executable it is from some of the basic types like PE, MZ, COM, ect. then how would it know how to read the PSP? Is there a function in the Winapi that could execute the code by calling the renamed program? I would be curious to know of such.
    : [/green]
    :

    try it yourself as I described twice before. rename myprog.exe to myprog.aaa (or some other nonsense extension) and execute it form a command prompt. It doesn't work from Windows explorer, as I also said twice before.
  • : : : : I want to know if I can change a file extension of a program. Instead of the program saying .exe I want it to say something else. Now I know that I can change the file etension through DOS, but it causes the program to not work. I want the program to work and have a different extension. Is this is possible could anyone show me how its done.
    : : : :
    : : : : --Digga
    : : : :
    : : : :
    : : : [green]
    : : : Your OS uses the file extension to determine how and where to read the PSP header in your executable. If you rename the file then the OS will assume that it is not an executable and not run it.
    : : : [/green]
    : : :
    : :
    : : maybe. please read my previous posts.
    : : :
    : :
    : :
    : [green]
    : I know you can rename a file but to execute it with the new file extension should fail since the PSP isn't being translated by the OS. If the OS doesn't know what kind of executable it is from some of the basic types like PE, MZ, COM, ect. then how would it know how to read the PSP? Is there a function in the Winapi that could execute the code by calling the renamed program? I would be curious to know of such.
    : [/green]
    :
    :
    :


    I just renamed an *.exe file to a *.asd file and it ran fine when calling it via the command prompt, so I tried it progmatically with CreateProcess() and it runs the changed file .ext as normal.


    [italic][blue]To understand recursive, first you need to understand recursive[/blue][/italic]

  • :
    : The rename through widows works, it just depends on what you are doing. You can change a .txt to a .doc. or a .exe to a .com. But you can't change a txt file to a exe file and stuff like that. What exactly is it you are doing?
    :


    I'll say this one more time -- for the third time -- You can name a file anything you want. Change a text file to have .exe, .com, .bat or any other extension. Windows doesn't give a crap what you call it. However, that does not mean that a text file can be executed just by renaming it to have .exe extension.
  • :
    : I just renamed an *.exe file to a *.asd file and it ran fine when calling it via the command prompt, so I tried it progmatically with CreateProcess() and it runs the changed file .ext as normal.


    AhHa! Finally someone who knows what the hell he is talking about! :-)
  • : :
    : : I just renamed an *.exe file to a *.asd file and it ran fine when calling it via the command prompt, so I tried it progmatically with CreateProcess() and it runs the changed file .ext as normal.
    :
    :
    : AhHa! Finally someone who knows what the hell he is talking about! :-)
    :

    LOL Stober I can see you banging your head on the keyboard trying to explain it three times!
    [italic][blue]To understand recursive, first you need to understand recursive[/blue][/italic]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories