Advertisement
JordanScripter1337

File Writer

Sep 18th, 2015
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // i hate you
  2. function WriteText(){
  3.     WScript.Echo("Enter the path of the specified text file.");
  4.         var path = WScript.StdIn.ReadLine();
  5.         WScript.Echo("Enter the text that you want.");
  6.         var text = WScript.StdIn.ReadLine();
  7.         var fso = new ActiveXObject("Scripting.FileSystemObject");
  8.         try{
  9.             var file = fso.OpenTextFile(path,2);
  10.             file.WriteLine(text);
  11.             file.Close();
  12.         }catch(e){
  13.             WScript.Echo("You entered the wrong things.");
  14.             WScript.StdIn.ReadLine();
  15.         }
  16. }
  17. WriteText();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement