Show/Hide Toolbars

EmEditor Help

Navigation: EmEditor Help > Macro Reference > Tutorial

EmEditor Macro Reference: Copy a File

Scroll Prev Top Next More
EmEditor Home - EmEditor Help - EmEditor Macro Reference - Tutorial

Copy a File

To copy a file, CopyFile Method of a FileSystemObject.

The following example code creates a backup of an open file.


if( document.FullName == '' ){

   alert( "The file is untitled." );


else {

   fso = new ActiveXObject( "Scripting.FileSystemObject" );

   fso.CopyFile( document.FullName, document.FullName + ".bak" );



If document.FullName = "" Then

   alert "The file is untitled."


   Set fso = CreateObject( "Scripting.FileSystemObject" )

   fso.CopyFile document.FullName, document.FullName + ".bak"

End If


g Microsoft MSDN Library: CopyFile Method

Copyright © 2003-2016 by Emurasoft, Inc.