06-01-23, 08:51 PM
02-06-23, 01:39 AM
(06-01-23, 08:51 PM)jam3h كتب : [ -> ]ممكن كود تشغيل ملف bat من resources
PHP كود :
String bf = @"D:\batchfile.bat";
System.IO.File.WriteAllText(bf, Properties.Resources.batchfile);
System.Diagnostics.Process.Start(bf);
03-06-23, 10:37 PM
كود :
using System;
using System.IO;
using System.Reflection;
namespace YourNamespace
{
class Program
{
static void Main(string[] args)
{
// اسم الملف الذي تم تضمينه في المصدر
string resourceName = "YourNamespace.Resources.YourFile.bat";
// استخراج الملف من المصدر
Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName);
if (resourceStream != null)
{
// تحويل محتوى الملف إلى مصفوفة بايت
byte[] fileBytes = new byte[resourceStream.Length];
resourceStream.Read(fileBytes, 0, (int)resourceStream.Length);
// تخزين الملف في مسار مؤقت
string tempFilePath = Path.GetTempFileName();
File.WriteAllBytes(tempFilePath, fileBytes);
// تشغيل الملف BAT
System.Diagnostics.Process.Start(tempFilePath);
}
else
{
Console.WriteLine("تعذر العثور على الملف في المصدر.");
}
Console.ReadLine();
}
}
}10-07-23, 12:36 PM
الاستدعاء من داخل Resources
IO.File.WriteAllBytes(My.Computer.FileSystem.SpecialDirectories.Temp & "\file.bat", My.Resources.file)
Process.Start(My.Computer.FileSystem.SpecialDirectories.Temp & "\file.bat")
استبدال file.bat ب اسم برنامجك
IO.File.WriteAllBytes(My.Computer.FileSystem.SpecialDirectories.Temp & "\file.bat", My.Resources.file)
Process.Start(My.Computer.FileSystem.SpecialDirectories.Temp & "\file.bat")
استبدال file.bat ب اسم برنامجك
23-10-23, 09:15 AM
A batch file is a text file that contains a sequence of commands for a computer operating system. Batch files encapsulate multiple commands into a single file, and are created for command sequences that users employ repeatedly.
Commonly used batch files are part of most operating systems. The sequence of commands in the batch file is initiated by entering the name of the batch file on the command line.
pikashow download
Commonly used batch files are part of most operating systems. The sequence of commands in the batch file is initiated by entering the name of the batch file on the command line.
pikashow download