1

I am trying to path multiples variables to an application using vbscript but it is not working for me and I do not know how to fix:

Set SH = WScript.CreateObject("WScript.Shell")

Set colFiles = objFolder.Files
For Each objFile in colFiles
  SH.Run ".\Resizer.exe /resize /overwrite /width: " & strResize & objFile.Path & objFile.Path,,True
Next

Resizer.exe will resize objFile.path (example: D:\pic.jpg) with strReszie width and will save it again as objFile.path

Where is the problem?

1 Answer 1

2

Two things:

  1. You're not putting any spaces between your params:

    strResize & objFile.Path & objFile.Path
    

    should be:

    strResize & " " & objFile.Path & " " & objFile.Path
    
  2. Make sure you surround any file paths with quotes, in case they contains spaces:

    strResize & " " & Chr(34) & objFile.Path & Chr(34) & " " & Chr(34) & objFile.Path & Chr(34)
    
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.