Private void RunNotepad()
{
Process Notepadprocess = new Process();
Notepadprocess.StartInfo = new ProcessStartInfo("notepad.exe", "E:\\New.txt");
Notepadprocess.Start();
}
The programmer's notebook is a reference for programmers. Here you can find code snippet's for VB.Net, C# .Net, WPF and many more...
Pages
Opening notepad from C# app
In this post i'll show you how to open notepad windows application from our C# project. This is useful when you want to display a particular text file to a user.
C# random filename generator
Import namespace
Sample output
using System.IO;Code
string path = @"C:\Folder\file.txt";
Console.WriteLine(path);
Console.WriteLine();
Console.WriteLine("Directory name: {0}", Path.GetDirectoryName(path));
Console.WriteLine("File name: {0}", Path.GetFileName(path));
Console.WriteLine("File name without extension: {0}", Path.GetFileNameWithoutExtension(path));
Console.WriteLine("File extension: {0}", Path.GetExtension(path));
Sample output
Directory name: C:\Folder File name: file.txt File name without extension: file File extension: .txt
Read available disk space
Does your program need to get the available disk space on your computer. Here's the .net code
Import namespace
Code
Import namespace
using System.IO;
Code
using System.IO; DriveInfo drive = new DriveInfo(@"C:\"); long space = drive.AvailableFreeSpace;
Subscribe to:
Comments (Atom)