Skip to content

Instantly share code, notes, and snippets.

@gtd3
gtd3 / CopyFile
Created August 20, 2013 18:00
Copy File from one location to another
'Copy URL shortcut from source(napsv0013) to destination Public Desktop
dim filesys
set filesys=CreateObject("Scripting.FileSystemObject")
If filesys.FileExists("\\Napsv0013\tcgnews\Alt_TCG_Camacct") Then
filesys.CopyFile "\\Napsv0013\tcgnews\Alt_TCG_Camacct", "C:\Users\Public\desktop\"
End If
@gtd3
gtd3 / CreateShortcut
Created August 20, 2013 17:57
Create a Shortcut
Set objShell = WScript.CreateObject("WScript.Shell")
'All users Desktop
allUsersDesktop = objShell.SpecialFolders("AllUsersDesktop")
'The current users Desktop
usersDesktop = objShell.SpecialFolders("Desktop")
'Where to create the new shorcut
Set objShortCut = objShell.CreateShortcut(usersDesktop & "\ALT_TCG_Camacct.url")
@gtd3
gtd3 / IfFileExists
Created May 22, 2013 20:34
[IF] FILE EXISTS [then] [Visual Studio]
Option Explicit
DIM fso
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists("C:\Program Files\conf")) Then
WScript.Echo("File exists!")
WScript.Quit()
Else
WScript.Echo("File does not exist!")
End If
@gtd3
gtd3 / Copy Directory
Created May 22, 2013 15:04
Visual Basic Copy DirectoryContents
My.Computer.FileSystem.CopyDirectory("C:\TestDirectory1", "C:\TestDirectory2", True)
@gtd3
gtd3 / CreateDirectory
Created May 22, 2013 01:05
Creates a folder in a specified location - Checks if folder already exists - Notifies weather folder was created or exists.
Option Explicit
Dim objFSO, objFolder, objShell, strDirectory
strDirectory = "C:\Program Files\Simplikate"
' Create the File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Note If..Exists. Then, Else ... End If construction
If objFSO.FolderExists(strDirectory) Then
Set objFolder = objFSO.GetFolder(strDirectory)