title: VBScript can create text file but can't delete file (permission denied)?
body: <p>I create a .vbs file (that can: creat text file -> Open notepad.exe -> delete the file above) like this:</p>
  
  <pre><code>' Create a new file
  Dim objFS, objFile
  Set objFS = CreateObject("Scripting.FileSystemObject")
  Set objFile = objFS.CreateTextFile("D:\Folder\Textfile.txt")
  objFile.WriteLine ("sample text")
  
  ' Run a program and wait
  WScript.CreateObject("WScript.Shell").Run "notepad.exe", 1, true
  
  ' Delete file
  objFS.Deletefile("D:\Folder\Textfile.txt")
  </code></pre>
  
  <p>But when I run it, after close notepad window, it show error message:</p>
  
  <pre><code>Line: 10
  Char: 1
  Error: Permission denied
  Code: 800A0046
  Source: Microsoft VBScript runtime error
  </code></pre>
  
  <p>I don't know why this .vbs can't not delete the text file? Thank you for any help!</p>