code_junkie

How can I hide a directory in C# with a file system driver

Nov 14th, 2011
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. // Get Application start up path
  2. string path = Application.StartupPath;
  3. // Create Batch File Path
  4. string filePath = path + "\Hide.bat";
  5. // Write syntex to write in BAtch File
  6. string strToWrite = "attrib +h +s " + '"' + path + '"';
  7. // Create Batch File
  8. FileStream fs = new FileStream(filePath, FileMode.Create);
  9. StreamWriter sw = new StreamWriter(fs);
  10. sw.WriteLine(strToWrite);
  11. sw.Close();
  12. fs.Close();
Add Comment
Please, Sign In to add comment