Originally Posted by
DMT Dave
Hi Guy's I am trying to open jpg files in ms paint, i am unsure if paint would require specific file names to open whereas I am trying to force it to open all files regardless of qty
From my testing it looks like ms paint only takes one argument, and using something like *.jpg only opens the first file. You will have to loop through your directory and open each file individually
I am trying to open them in ms paint to resize them for emailing
Can you elaborate on what/how you're doing this? This could probably be automated as well.
Finally, as others have mentioned your syntax for the shell command is off. It's a good idea to enclose any paths or filenames within shell commands in quotation marks. Otherwise, generally speaking, a shell command's argument parser will split everything by any spaces. If there are any spaces in any directory names or file names it won't be interpreted correctly.
For example:
Code:
Shell "C:\Windows\System32\mspaint.exe C:\My Picture.jpg"
would send the following to the command line:
Code:
C:\Windows\System32\mspaint.exe C:\My Picture.jpg
Which would get split by spaces like this
Code:
C:\Windows\System32\mspaint.exe
C:\My
Picture.jpg
C:\My isn't a valid path so the command C:\Windows\System32\mspaint.exe wouldn't know what to do
The correct way to issue that shell command would need escaped quatation marks like this:
Code:
Shell "C:\Windows\System32\mspaint.exe ""C:\My Picture.jpg"""
Which sends the following to the command line:
Code:
C:\Windows\System32\mspaint.exe "C:\My Picture.jpg"
Because "C:\My Picture.jpg" is surronded in quotes it doesn't get split at the space character and is treated as one argument instead of two.
*Note: if the path to the executable you're trying to run has any spaces in it you'll need to surround it in quotation marks as well:
Code:
Shell """C:\Windows\System32\mspaint.exe"" ""C:\My Picture.jpg"""