Results 1 to 5 of 5

Thread: VB Batch Script?

  1. #1

    Thread Starter
    Addicted Member S@NSIS's Avatar
    Join Date
    Aug 2000
    Location
    Stoke-On-Trent, England
    Posts
    243

    Question

    Hi,
    I have the following script in a batch file:

    rem Extracts source code from sourcesafe

    rem set sourcesafe database
    set ssdir=\\path to server
    set path=%path%;c:\program files\Microsoft Visual Studio\common\vss\win32;c:\program files\microsoft visual studio\vb98

    rem destroy old extract folder and extract sourcesafe code into there
    cd c:\
    attrib -r c:\extract /s
    del c:\extract /s /q
    mkdir c:\extract
    cd c:\extract
    ss get $/ -R -I-N



    what I would like to know is: Is it possible to run these commands from VB without the need for the batch file?

    Thanks in advance,

    Shaun

    Web/Application Developer
    VB6 Ent (SP5), Win 2000,SQL Server 2000

  2. #2

    Thread Starter
    Addicted Member S@NSIS's Avatar
    Join Date
    Aug 2000
    Location
    Stoke-On-Trent, England
    Posts
    243

    Unhappy Really struggling

    Hi again,
    I have searched everywhere and it seems that I cannot do the above! However, can I pass a parameter to a batch file through VB and then how do I access that parameter within the batch file.

    ie:
    Code:
    'execute the batch file with parameter Sitename
    iShell = Shell("C:\Build.bat %Sitename%")
    Any help will be appreciated

    Shaun
    Web/Application Developer
    VB6 Ent (SP5), Win 2000,SQL Server 2000

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Is the %sitename% saved in a string variable or is it a environment variable?

    If it's the earlier do this:
    Code:
    Call Shell("C:\build.bat " & sSiteName, vbNormalFocus)
    Otherwise do this:
    Code:
    Call Shell("C:\build.bat " & Environ("SiteName"), vbNormalFocus)
    In the BAT file use %1 to get the first argument. (%2 for the second and so on)

    Good luck!

  4. #4

    Thread Starter
    Addicted Member S@NSIS's Avatar
    Join Date
    Aug 2000
    Location
    Stoke-On-Trent, England
    Posts
    243
    Thanks Joacim,
    Sitename will just be a String Variable from VB. It works fine with:
    Code:
    call shell ("C:\build.bat" & strSiteName, vbNormalFocus)
    Just one more question though if you don't mind:

    what is an environment variable? (is it like a global/local?)

    thanks again

    Shaun
    Web/Application Developer
    VB6 Ent (SP5), Win 2000,SQL Server 2000

  5. #5
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    No environment variables is mostly used in DOS.
    Path, ComSpec and Temp are maybe the most used.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width