/build/static/layout/Breadcrumb_cap_w.png

VB script for placing .dat file in specified location

hi

i need a VB script for placing .dat file in following location :

Documents and Settings\All Users\Application Data\Symantec\Symantec AntiVirus Corporate Edition\7.5

reply..
thanks ..

0 Comments   [ + ] Show comments

Answers (4)

Posted by: jamsek19 17 years ago
Orange Senior Belt
0
Hi.

You can get that folder using

destDir = Property("CommonAppDataFolder")
for "C:\Documents and Settings\All Users\Application Data" folder (CommonAppDataFolder is Installer property) or,
if you need to copy during deferred phase you can get App data folder from environment:

Set WSHShellObj = CreateObject("WScript.Shell")
Set EnvObject = WSHShellObj.Environment("PROCESS")
destDir = EnvObject.Item("ALLUSERSPROFILE") & "\Application Data"
Set EnvObject = Nothing
Set WSHShellObj = Nothing


To copy a file you can use

Set FSObj = CreateObject("Scripting.FileSystemObject")
Set srcFileObj = FSObj.GetFile("yoursrcfile.dat")
srcFolderFileObj.Copy destFile, False
If (FSObj.FileExists(destFile)) Then
' Wscript.Echo "Copying done."
Else
' Wscript.Echo "Copying failed. Error " & GetErrMsg
End If



Best regards
Andreo
Posted by: spartacus 17 years ago
Black Belt
0
if you need to copy during deferred phase you can get App data folder from environment:

Just a word of caution - this may not work if you use Deferred In System Context as most of the more common environment variables will generally not be defined in that particular context.

Regards,

Spartacus
Posted by: jamsek19 17 years ago
Orange Senior Belt
0
Spartacus,
thanks for information.
Now I understand why one of my script fails ;-)
Is this because of System account settings or because script is running in deferred in system context sequence?

Best regards

Andreo
Posted by: spartacus 17 years ago
Black Belt
0
Most likely due to the deferred in system context you have selected. Have you tried out the script just deferred but not in system context ?

Regards,

Spartacus
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ