Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #11158

VB script question

Newsgroups microsoft.public.scripting.vbscript
Date 2015-10-28 11:21 -0700
Message-ID <ea803277-4f6e-48f0-ab87-9faba81c7e25@googlegroups.com> (permalink)
Subject VB script question
From sthakker15@gmail.com

Show all headers | View raw


Hello I have 3 different vb Scripts that I like to put it in one.
And the script should be run only if the folder or file not present. Scripts should run so people can not see any error messages. Trying to avoid phone calls to help desk.Is it possible to make a one script out of all three if yes can I get an example of the script. I have Windows 7 machines in my organization.

Script 1 Creates folder (Because root folder exist but not the entire path)
========================================
Option Explicit

Dim shl
Set shl = CreateObject("WScript.Shell")
Call shl.Run("%COMSPEC% /c mkdir ""%APPDATA%\Microsoft\Document Building Blocks\1033\15""",0,true)
=================================================

Script 2
==================================================
Set objFSO = CreateObject("Scripting.FileSystemObject")
set objWShell = wScript.createObject("WScript.Shell")

usrName = objWShell.expandEnvironmentStrings("%USERNAME%")

objFSO.CopyFile "\\192.168.80.19\public\building blocks.dotx " , "C:\Users\" & usrName & "\appdata\Roaming\Microsoft\Document Building Blocks\1033\", True
=======================================================

Script 3
===============================================
Set objFSO = CreateObject("Scripting.FileSystemObject")
set objWShell = wScript.createObject("WScript.Shell")

usrName = objWShell.expandEnvironmentStrings("%USERNAME%")

objFSO.CopyFile "\\192.168.80.19\public\building blocks.dotx " , "C:\Users\" & usrName & "\appdata\Roaming\Microsoft\Document Building Blocks\1033\15\", True
==============================================================================


All three scripts work from the same User Login script group policy. But like to enhance it little but by making it one script.

Back to microsoft.public.scripting.vbscript | Previous | NextNext in thread | Find similar


Thread

VB script question sthakker15@gmail.com - 2015-10-28 11:21 -0700
  Re: VB script question JJ <jj4public@vfemail.net> - 2015-10-29 19:13 +0700
    Re: VB script question Todd Vargo <tlvargo@sbcglobal.netz> - 2015-10-31 12:52 -0400
  Re: VB script question sthakker15@gmail.com - 2015-10-29 10:23 -0700

csiph-web