0

I am looking for a way to execute Windows commands in protractor test cases, like this: copy D:\xx\xx\xx.js d:\xxxx\xxxx

Is it possible to do so? Or is there any other way to do this?

Bob Bai
  • 283
  • 4
  • 20
  • Possible duplicate of http://stackoverflow.com/questions/1880198/how-to-execute-shell-command-in-javascript – Machtyn Jun 14 '16 at 03:38

1 Answers1

1

Actually I need to move a file to another location. I have successfully made it by nodeJS function fs.rename() like the following:

var fs = require('fs');
var path = require('path');

var fileName = "coverflow-3.0.1.zip";

var sourceFile = path.join(__dirname, fileName);
var destPath = path.join(__dirname, fileName);

fs.rename(sourceFile, destPath, function (err) {
  if (err) throw err;
  fs.stat(destPath, function (err, stats) {
    if (err) throw err;
    console.log('stats: ' + JSON.stringify(stats));
  });
});
Bob Bai
  • 283
  • 4
  • 20