Hello,
here is my script:
var LOCALPATH = ".\\";
var REMOTEPATH = "/";
var FILE = "winscp421.exe";
var SESSION = "test@127.0.0.1";
var WINSCP = "c:\\program files\\winscp
function pad(n, len)
{
var s = n.toString();
while (s.length < len)
{
s = '0' + s;
}
return s;
}
var date = new Date();
// format timestamp
var stamp =pad(date.getFullYear(), 4) + pad(date.getMonth(), 2) + pad(date.getDate(), 2);
document.write("Date Job:" +stamp);
This script should be triggered by batch process(bat file from Microsoft scheduler).
At this point all what I need is to confirm that date get written into variable stamp.
Result is error:
C:\>test.bat
C:\>cscript c:\test.js
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
c:\test.js(28, 1) Microsoft JScript runtime error: 'document' is undefined
Why and how I can fix this. Normally all my JS files works fine but here I hit brick wall....