Is it possible to embed a bat file in .exe and use it with the Process class?

前端 未结 4 1012
轻奢々
轻奢々 2021-01-06 13:25

I\'ve created a batch file that is being used with a Process. I currently just have the application pointing to a directory on my local machine.

Rather than having

4条回答
  •  猫巷女王i
    2021-01-06 13:49

    As for embedding the batch file - you can embed just about anything if need be... the answer to this is yes :-)

    As for how to use the embedded batch file - the easiest option is the read it from the resource (see http://msdn.microsoft.com/en-us/library/system.resources.resourcemanager.aspx and http://msdn.microsoft.com/en-us/library/system.reflection.assembly.getmanifestresourcestream.aspx) and save it as a real file - then use that.

    IF you would embed a .NET EXE/DLL you could use that without saving it as a real file... with a batch file I suspect you will need to save it as a real file.

提交回复
热议问题