I have a batch file i want to create from my Resources.
I know this method for creating a file for .exe files:
byte [] resource_bytes = Project.Properties.Resources.exefile;
File.WriteAllBytes(path, resource_bytes);
It doesn't work the same for batch files.
Does someone has a solution?
A windows Batch file (bat)
is a text file, Try this one:
if (!string.IsNullOrEmpty(text))
{
File.WriteAllText(resourcePath, text);
}
else
{
MessageBox.Show("The Batch file is empty");
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.