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 9293693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T21:11:57+00:00 2026-06-18T21:11:57+00:00

I have a problem. I need to throw some synchronized commands in vbscript (one

  • 0

I have a problem. I need to throw some synchronized commands in vbscript (one Run method, Delete one and moveFile one) in every cycle to my loop. I don’t know how I do it.

My code is that:

Public Function UnificarCRIs(ByVal path, ByVal FICRIEC, ByVal sessio, ByVal CIBAA)
    Dim objFile, objCurrentFolder, filesys, origenFitxers
    Dim FileName, WshShell

    On error resume next

    Set filesys = CreateObject("Scripting.FileSystemObject")
    Set WshShell = WScript.CreateObject("WScript.Shell")
    Set objCurrentFolder = filesys.getFolder(path)

    For Each objFile In objCurrentFolder.Files
        FileName = objFile
        If (right(FileName, 4) = ".cri") Then
            If filesys.FileExists(path & FICRIEC & sessio) Then
                 'WshShell.Run ("copy " & path & FICRIEC & sessio & "+" & FileName & " " & path & FICRIEC & sessio & "_tmp")
                 WshShell.run ("cmd /K " & "copy /Y " & path & FICRIEC & sessio & "+" & FileName & " " & path & FICRIEC & sessio & "_tmp",8,TRUE)
                 Set WshShell = Nothing
                 filesys.DeleteFile path & FICRIEC & sessio
                'filesys.MoveFile path & FICRIEC & sessio & "_tmp", path & FICRIEC & sessio
            Else
                WshShell.run "cmd /K " & "copy /Y " & FileName & " " & path & FICRIEC & sessio,8,TRUE
                Set WshShell = Nothing
            End If     
        End If 
    Next

End Function
  • 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-18T21:11:59+00:00Added an answer on June 18, 2026 at 9:11 pm

    Read the docs for .Run completely and reflect on the bWaitOnReturn parameter.

    Apology:

    Sorry, I didn’t read your code carefully enough. The .Run should wait. But I see that you use a global On Error Resume Next and param list () in

    WshShell.run ("cmd /K " & "copy /Y " & path & FICRIEC & sessio & "+" & FileName & " " & path & FICRIEC & sessio & "_tmp",8,TRUE)
    

    What happens, when you remove those mistakes? Are you sure, that you have a usable WshShell in the second pass thru the loop?

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

Sidebar

Related Questions

I have a problem, I need to change body of method when this class
I have a problem with some code I need to refactor. Right now it
I have problem i need to convert from my Array structure to std::vector<int> ...
I have a problem where I need to split an input string into possible
I have a problem where I need to remove all code and triggers from
I have the following problem: I need to use XSLFO to generate a 2-column
I have the next problem: I need to process only 1 request at a
OSX 10.7, XCode 4. I have a small problem: I need to push back
I have a problem with Matlab - I need to do the following :
I have a problem with Json formating returned from .ASMX I need to return

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.