উত্তর:
using System.Diagnostics;
class Program
{
static void Main()
{
Process.Start("C:\\");
}
}
যদি আপনার অ্যাপ্লিকেশনটিতে সেন্টিমিটার আর্গুমেন্টের প্রয়োজন হয় তবে এই জাতীয় কিছু ব্যবহার করুন:
using System.Diagnostics;
class Program
{
static void Main()
{
LaunchCommandLineApp();
}
/// <summary>
/// Launch the application with some options set.
/// </summary>
static void LaunchCommandLineApp()
{
// For the example
const string ex1 = "C:\\";
const string ex2 = "C:\\Dir";
// Use ProcessStartInfo class
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.CreateNoWindow = false;
startInfo.UseShellExecute = false;
startInfo.FileName = "dcm2jpg.exe";
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.Arguments = "-f j -o \"" + ex1 + "\" -z 1.0 -s y " + ex2;
try
{
// Start the process with the info we specified.
// Call WaitForExit and then the using statement will close.
using (Process exeProcess = Process.Start(startInfo))
{
exeProcess.WaitForExit();
}
}
catch
{
// Log error.
}
}
}
উদাহরণ:
System.Diagnostics.Process.Start("mspaint.exe");
কোড সংকলন
কোডটি অনুলিপি করুন এবং এটি কনসোল অ্যাপ্লিকেশনটির মূল পদ্ধতিতে আটকান । আপনি যে অ্যাপ্লিকেশনটি চালাতে চান তার পথে "mspaint.exe" প্রতিস্থাপন করুন।
Process.Start()
আমি জানি এটির উত্তরের জবাব দেওয়া আছে তবে আপনি যদি আগ্রহী হন তবে আমি একটি লাইব্রেরি লিখেছিলাম যা কার্যকর করার আদেশগুলি আরও সহজ করে তোলে।
এটি এখানে দেখুন: https://github.com/twitchax/ শেলার ।
startInfo.UseShellExecute = falseএকটি দুর্দান্ত জিনিস ছিল ... এটি আমার জন্য কবজির মতো কাজ করেছিল! ধন্যবাদ! :)