Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Prompt within vb script.

Status
Not open for further replies.

roboyle

Technical User
Oct 5, 2011
6
US
Hi Guys-

Really quite new to vb scripting,
I'm trying to set up a command prompt within a vb script.



Dim fso,f,ext,firstChar,numOfPics,workingFolder,newFileName

workingFolder = "."
numOfPics = 0
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(workingFolder)
For Each file In f.Files
firstChar = mid(file.Name,1,1)
ext = mid(file.Name,(len(file.Name) - 2),3)
if firstChar = "P" and ext = "JPG" then
numOfPics = numOfPics + 1
newFileName = mid(file.Name,2,len(file.Name) - 1)
fso.MoveFile workingFolder & "\" & file.Name, workingFolder & "\" & newFileName
end if


Next
wscript.echo "Total renamed pics: " & numOfPics
Set fso = Nothing


DIM objShell
set objShell = wscript.createObject("wscript.shell")
iReturn = objShell.Run("%COMSPEC%/K Dir z:\Photgraph\convert -resize 120x150 *.jpg *)


The first part of the script works fine for renaming a batch file of images. In the second part, i'm trying to run a command prompt which re-sizes the images.

DIM objShell
set objShell = wscript.createObject("wscript.shell")
iReturn = objShell.Run("%COMSPEC%/K Dir z:\Photgraph\convert -resize 120x150 *.jpg *)

Any help would be greatly appreciated.
 
Haven't used vb much but this might help.


Avaya_Red.gif

___________________________________________
It works! Now if only I could remember what I did...

Dain Bramaged (Avaya Search tool )
______________________________________
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top