stev379
2006-03-01 14:54:40 UTC
The snippet below checks for a flag file, and works fine when I'm logged in
as an admin on XP, but errors on the Set objFile =
objFSO.CreateTextFile("C:\PTRMIG_FLG_.txt") line when logged in as a Power
User or less. It returns a Permission Denied error. How can I create a file
on the root of a machines C: drive or the root of the currently logged on
users profile?
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Check for flag file and stop script if it exists
If objFSO.FileExists("C:\PTRMIG_FLG_.txt") Then
WScript.Quit
Else
Set objFile = objFSO.CreateTextFile("C:\PTRMIG_FLG_.txt")
End If
Thanks for any help or suggestions!
as an admin on XP, but errors on the Set objFile =
objFSO.CreateTextFile("C:\PTRMIG_FLG_.txt") line when logged in as a Power
User or less. It returns a Permission Denied error. How can I create a file
on the root of a machines C: drive or the root of the currently logged on
users profile?
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Check for flag file and stop script if it exists
If objFSO.FileExists("C:\PTRMIG_FLG_.txt") Then
WScript.Quit
Else
Set objFile = objFSO.CreateTextFile("C:\PTRMIG_FLG_.txt")
End If
Thanks for any help or suggestions!