JL.
JL.

Reputation: 81342

Process.start in c#, not firing

I am trying to create some files using fsutil, but no files are getting created with the following loop, neither is an error getting generated, any suggestions?

foreach (string extension in extensions)
{
   Process.Start("fsutil", @"file createnew e:\attachments\" + DateTime.Now.ToString() + extension); 
}

Upvotes: 0

Views: 391

Answers (1)

J. Steen
J. Steen

Reputation: 15578

DateTime.Now.ToString() might be returning spaces and characters that aren't allowed in filenames. Try quoting the filename for the argument string and replacing any colons with underscores, or the like. FSUTIL also requires the length of the file to be specified, as ArsenMkrt stated.

Usage : fsutil file createnew <filename> <length>
   Eg : fsutil file createnew C:\testfile.txt 1000

Upvotes: 4

Related Questions