Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8144001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:15:29+00:00 2026-06-06T13:15:29+00:00

Would like someone to take a look at my script and tell me where

  • 0

Would like someone to take a look at my script and tell me where I am messing up.

It is a script to zip log files and then I would like to move them into a new folder that is going to be shared over a network. Right now I am just trying to get the part where it zips up the files using 7zip correctly.

I am very new to VB (like 2 days) so having some syntax problems I think.

Script is found below, thank you in advance for all advice and help

Option Explicit

WScript.Echo "Press to start zipping log files."

Dim objFile, objPath, objFolder, Command, PathLogs, RetVal
Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objShell: Set objShell = CreateObject("WScript.Shell")

PathLogs = "C:\Testscripts\testfolder\" 'This path just has some test logs

‘ Loop through the logs and zip and move each file (if required, you could just move files with an ‘.log’ extension)

Set objPath = objFSO.GetFolder(PathLogs)
For Each objFile In objPath.Files
If (LCase(objfso.GetExtensionName(objFile)) = "log") Then
    Wscript.Echo objFile.Name
    ' zip and move files
    'Command = """C:\Program Files\7-zip\7z.exe"" -m -ex """ & PathLogs &     \objFile.Name objfso.GetBaseName(objFile) & "*.zip"" """ & PathLogs & objFile.Name & """"
     Command = ""C:\Program Files\7-zip\7z.exe"" a -m -ex " & PathLogs & "" & objFile.Name & ".zip " & PathLogs & "" & objFile.Name & "
        WScript.Echo "Command: " & Command
RetVal = objShell.Run(Command,0,true)

End If

Next

WScript.Echo "Zip Successful."
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:15:30+00:00Added an answer on June 6, 2026 at 1:15 pm

    You have your quotes wrong. To use a quote inside a string, you have to duplicate the quote.

    Command = """C:\Program Files\7-zip\7z.exe"" a -m -ex " _ 'this is the first part of the string
              & PathLogs & objFile.Name & ".zip " & PathLogs & objFile.Name
    

    If your Logfile or PathLogs can contain spaces they must be quoted as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like someone to clarify something for me: There are two kinds of
I would like someone to explain me what _forward is exactly doing, I cannot
I have a confusion regarding DataContext which i would like someone to confirm or
I have a search form. I would like when someone type the term, first
I would like to know if someone knows why I can't send sms with
i would like to know if there is an event for every time someone
Would someone be able to help here? I would like to fill a div
I would like to access a MySQL database using PHP. Can someone please explain
Hope someone could help me with this: I would like to have a column
I would like to add results into array and print on screen. Here's my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.