Good afternoon
I have the below scripts which I need to run in one script.
I cant get the second script to execute so I think I'm missing command line to continue
can anyone advise whats missing please, the script is below?
I need to run script 1, then script 2 then end all within one vbscript but I am missing the command to get it to move onto script 2 correctly I think?
'script1 - input HKCU
On Error Resume Next
const HKCU = &H80000001
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
Set wshShell = CreateObject( "WScript.Shell" )
Sammie = wshShell.ExpandEnvironmentStrings("%USERNAME%")
Key = "Software\Microsoft\Office\16.0\Word\Options"
oReg.CreateKey HKCU, Key
oReg.SetStringValue HKCU, Key, "PersonalTemplates", "C:\Program Files (x86)\Office Templates"
Set oReg = Nothing
set wshShell = Nothing
'script 2 - copy file
Option Explicit
Dim oFSO, strAppData, objShell
Set objShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
objShell.CurrentDirectory = oFSO.GetParentFolderName(WScript.ScriptFullName)
strAppData=objShell.ExpandEnvironmentStrings("%APPDATA%") & "\Microsoft\templates" & "\"
oFSO.CopyFile "blank.potx", strAppData, True
Set objShell = Nothing
Set oFSO = Nothing
Thank you
I have the below scripts which I need to run in one script.
I cant get the second script to execute so I think I'm missing command line to continue
can anyone advise whats missing please, the script is below?
I need to run script 1, then script 2 then end all within one vbscript but I am missing the command to get it to move onto script 2 correctly I think?
'script1 - input HKCU
On Error Resume Next
const HKCU = &H80000001
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
Set wshShell = CreateObject( "WScript.Shell" )
Sammie = wshShell.ExpandEnvironmentStrings("%USERNAME%")
Key = "Software\Microsoft\Office\16.0\Word\Options"
oReg.CreateKey HKCU, Key
oReg.SetStringValue HKCU, Key, "PersonalTemplates", "C:\Program Files (x86)\Office Templates"
Set oReg = Nothing
set wshShell = Nothing
'script 2 - copy file
Option Explicit
Dim oFSO, strAppData, objShell
Set objShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
objShell.CurrentDirectory = oFSO.GetParentFolderName(WScript.ScriptFullName)
strAppData=objShell.ExpandEnvironmentStrings("%APPDATA%") & "\Microsoft\templates" & "\"
oFSO.CopyFile "blank.potx", strAppData, True
Set objShell = Nothing
Set oFSO = Nothing
Thank you