Hi,
I’m a complete novice at this so please bear with my ignorance.
I have taken part of some code I know works and simply added a print statemet to it as I want it to print to the command prompt, where I am running the script, the value of REMOTEDIR
Can you please let me know why the addition of the print statement provides an error:
ERROR:
JScript runtime error: Object expected
CODE:
var date = new Date();
// helper function to pad zeroes to the
left of number
function pad(n, len)
{
var s = n.toString();
while (s.length < len)
{
s = ‘0’ + s;
}
return s;
}
// format remote directory name
var REMOTEDIR =
pad(date.getFullYear(), 4) +
pad(date.getMonth()+1, 2) +
pad(date.getDate()-1, 2);
print(REMOTEDIR);