vbscript to create file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hellow All,

Below is an excerpt from a VB script file that does not execute on Vista....
Can anyone be kind enough to provide any feedback on it? It bombs on the
last line....I get the "Permission Denied" 800A0046 error.
I tried to remove all right and have it run in the administrator group, but
failed miserably...... Any help would be appreciated....


tempdate = now()
dim filenamedate 'format is _mmmdd.yyyy_hh.mm
filenamedate = MonthName(DatePart("m",tempdate), True) 'abbreviated month
name
filenamedate = "_" & filenamedate & DatePart ("d",tempdate) &_
"." & DatePart ("yyyy",tempdate) & "_"
temp = DatePart ("h",tempdate)
If temp < 10 Then temp = "0" & temp
filenamedate = filenamedate & temp & "." 'hour as hh
temp = DatePart ("n",tempdate)
If temp < 10 Then temp = "0" & temp
filenamedate = filenamedate & temp 'minutes as mm
logfilename = OutputFilePrefix & "_Log" & filenamedate & ".txt"
set logfileobj = fso.createtextfile(logfilename,true)
 
Valerio said:
Hellow All,

Below is an excerpt from a VB script file that does not execute on
Vista....
Can anyone be kind enough to provide any feedback on it? It bombs on the
last line....I get the "Permission Denied" 800A0046 error.
I tried to remove all right and have it run in the administrator group,
but
failed miserably...... Any help would be appreciated....


tempdate = now()
dim filenamedate 'format is _mmmdd.yyyy_hh.mm
filenamedate = MonthName(DatePart("m",tempdate), True) 'abbreviated month
name
filenamedate = "_" & filenamedate & DatePart ("d",tempdate) &_
"." & DatePart ("yyyy",tempdate) & "_"
temp = DatePart ("h",tempdate)
If temp < 10 Then temp = "0" & temp
filenamedate = filenamedate & temp & "." 'hour as hh
temp = DatePart ("n",tempdate)
If temp < 10 Then temp = "0" & temp
filenamedate = filenamedate & temp 'minutes as mm
logfilename = OutputFilePrefix & "_Log" & filenamedate & ".txt"
set logfileobj = fso.createtextfile(logfilename,true)


May be the permissions for the particular directory in which you are trying
to create your output file
 
That code is not complete. The following is the path (No drive letter?) which you're trying to create:

- - -
_Log_Feb7.2007_13.51.txt
- - -

What does the variable "OutputFilePrefix" contain? For me to replicate the problem, I need the complete code.

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows XP Shell/User]
Windows® XP Troubleshooting http://www.winhelponline.com


Hellow All,

Below is an excerpt from a VB script file that does not execute on Vista....
Can anyone be kind enough to provide any feedback on it? It bombs on the
last line....I get the "Permission Denied" 800A0046 error.
I tried to remove all right and have it run in the administrator group, but
failed miserably...... Any help would be appreciated....


tempdate = now()
dim filenamedate 'format is _mmmdd.yyyy_hh.mm
filenamedate = MonthName(DatePart("m",tempdate), True) 'abbreviated month
name
filenamedate = "_" & filenamedate & DatePart ("d",tempdate) &_
"." & DatePart ("yyyy",tempdate) & "_"
temp = DatePart ("h",tempdate)
If temp < 10 Then temp = "0" & temp
filenamedate = filenamedate & temp & "." 'hour as hh
temp = DatePart ("n",tempdate)
If temp < 10 Then temp = "0" & temp
filenamedate = filenamedate & temp 'minutes as mm
logfilename = OutputFilePrefix & "_Log" & filenamedate & ".txt"
set logfileobj = fso.createtextfile(logfilename,true)
 
Good Afternoon,
I should mention that the code is only an excerpt, and it did run correctly
under Windows XP SP2. It would create a Log file.
The VBScript is currently trying to backup my stuff (to a Y: Drive on a diff
computer) and create a log file under the C:\ drive.
 
Back
Top