You are not logged in.

trash

Resteverzehrer

  • "trash" started this thread

Posts: 1,025

Thanks: 1376

  • Send private message

2

Thursday, October 20th 2011, 6:44pm

OK, habe es gefunden.

Damit klappt es

Source code

1
2
3
4
5
6
7
8
9
function copy()
{
      var myObject, f;     
      myObject=new ActiveXObject("Scripting.FileSystemObject");
      f = myObject.GetFile("C:\\test.txt");
      f.copy("C:\\mytest.txt", true);
}

copy();

trash

Resteverzehrer

  • "trash" started this thread

Posts: 1,025

Thanks: 1376

  • Send private message

1

Thursday, October 20th 2011, 6:38pm

JavaScript

Weiß jemand weshalb mit dieser Funktion ein Fehler erscheint?

Source code

1
2
3
4
5
6
7
8
 function copy()
    {
      var myObject, f;
      myObject = new ActiveXObject("Scripting.FileSystemObject");
      f = myObject.file.copy("C:\\test.txt", "C:\\mytest.txt");
    }

copy();


Fehlermeldung. Er meckert wegen .file.


Kann das mal bitte jemand testen, ob das nur bei mir so ist. Die Funktion muss als Datei mit Endung js gespeichert und dann doppelgeklickt werden. Vorher eine Datei test.txt in C:\ anlegen.

Diese nächste Funktion funktioniert bei mir, wenn man sie als .js Datei ausführt und sich eine Textdatei in Laufwerk C:\ befindet, sprich die Datei wird gelöscht. An MS JScript kann es also nicht liegen, auch weil ich ja schon andere JScripte ausgeführt habe.

Source code

1
2
3
4
5
6
7
8
9
function remove()
{
  var myObject, f;
  myObject = new ActiveXObject("Scripting.FileSystemObject");
  f = myObject.GetFile("C:\\test.txt");
  f.Delete();
}

remove();


JavaScript Experten hier?