VB COM for current directory 
Author Message
 VB COM for current directory

Does anyone have a COM object  they can share that will perform a change
current directory? I am converting batch files to WSH and need to change
directory often.
thanks

--
Janice Sutherland
Hewlett-Packard Company
Advanced Systems Lab
916-785-0899



Sat, 20 Jul 2002 03:00:00 GMT  
 VB COM for current directory
Hi Janice,
study this small VBScript and try with the WSH-help to
build an VBScript solving your task.
Regards
Ulf

Rem VBS "a01.vbs"
Rem Zweck : Details of the FileSystemObject, File-Type
Rem                   Ofile1
Rem         Properties : 01 .Path
Rem                      02 .Name
Rem                      03 .ShortPath
Rem                      04 .ShortName
Rem                      05 .Drive
Rem                      06 .ParentFolder
Rem                      07 .Attributes
Rem                      08 .DateCreated
Rem                      09 .DateLastMidified
Rem                      10 .DateLastAccessed
Rem                      11 .Size
Rem                      12 .Type
Rem
Rem         Methods    : 01  .GetFile()
Rem
Rem VB6-like Notation
Rem Option Base 1
Rem Option Compare Binary
Rem DefInt  I, DefLng L,  DefSng S, DefDbl D, DefCur M
Rem DefStr  C, DefDate J, DefVar V, DefObj O
Rem --------------------------------------------------

Option Explicit

Private       OWSHobj1
Private Const CWSHobj1
= "Scripting.FileSystemObject"
Private       Ofile1
Private Const Cfile1                = "d:\vbsprogramme1
\exch1\a01.vbs"

Private       Cdisp1

Private Const Ctitle1               = "FileSystemObjekt,
File-Type"
Private Const COf1                  = "Ofile1"
Private Const COf1Path1
= "         .Path                      : "
Private Const Cof1Name1
= "         .Name                    : "
Private Const Cof1ShortPath1
= "         .ShortPath              : "
Private Const COf1ShortName1
= "         .ShortName            : "
Private Const COf1Drive1
= "         .Drive                      : "
Private Const COf1Msg1              = "+"
Private Const COf1ParentFolder1
= "         .ParentFolder          : "
Private Const COf1Attributes1
= "         .Attributes                : "
Private Const Cof1DateCreated1
= "         .DateCreated           : "
Private Const COf1DateLastModified1
= "         .DateLastModified   : "
Private Const COf1DateLastAccessed1
= "         .DateLastAccessed : "
Private Const COf1Size1
= "         .Size                        : "
Private Const COf1Type1
= "         .Type                       : "

Set OWSHobj1 = CreateObject(CWSHobj1)
Set Ofile1   = OWSHobj1.GetFile(Cfile1)

With Ofile1
  Cdisp1     = Cdisp1 &
COf1                                      & vbCrLf
  Cdisp1     = Cdisp1 & COf1Path1
& .Path             & vbCrLf
  Cdisp1     = Cdisp1 & COf1Name1
& .Name             & vbCrLf
  Cdisp1     = Cdisp1 & COf1ShortPath1
& .ShortPath        & vbCrLf
  Cdisp1     = Cdisp1 & COf1ShortName1
& .ShortName        & vbCrLf
  Cdisp1     = Cdisp1 & COf1Drive1            &
COf1Msg1         & vbCrLf
  Cdisp1     = Cdisp1 & COf1ParentFolder1     &
COf1Msg1         & vbCrLf
  Cdisp1     = Cdisp1 & COf1Attributes1
& .Attributes       & vbCrLf
  Cdisp1     = Cdisp1 & COf1DateCreated1
& .DateCreated      & vbCrLf
  Cdisp1     = Cdisp1 & COf1DateLastModified1
& .DateLastModified & vbCrLf
  Cdisp1     = Cdisp1 & COf1DateLastAccessed1
& .DateLastAccessed & vbCrLf
  Cdisp1     = Cdisp1 & COf1Size1
& .Size             & vbCrLf
  Cdisp1     = Cdisp1 & COf1Type1
& .Type             & vbCrLf
End With

Msgbox   Cdisp1, 64, Ctitle1

Set Ofile1   = Nothing
Set OWSHobj1 = Nothing

* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping.  Smart is Beautiful



Tue, 23 Jul 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. VB Script to change to current directory,

2. Get application directory instead of current directory.

3. need vb script to change users home directory in on fell swoop (active directory)

4. Problem loading VB Com in VB Script

5. VB Script and VB Com

6. Call VB DLL or COM object from within VB COM object or EXE

7. Current Directory

8. Default vs Current Directory (Folder)

9. import excel file from current directory

10. How to get the current directory

11. How to code path to current directory

12. How to determine current database directory

 

 
Powered by phpBB® Forum Software