本文介绍了简单的HTA脚本可调整照片文件夹的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用命令行版本的resize.exe(用于调整图像大小的程序)

I am using a command line version of resize.exe (a program to resize images)

我正在尝试创建一个简单的HTA应用程序,该应用程序将接收用户输入并将其传递给CMD.这里的问题是将批处理脚本放入VBS时我的批处理脚本失败了.

I am trying to create a simple HTA application that will receive user input and pass it to a CMD. The problem here is that my batch script is failing when placing it in the VBS.

我逃避了这个错误吗?还是需要添加其他内容?

Am I escaping this wrong or is there something else that needs to be added?

<html>
<head>
<title>HTA Test</title>
<HTA:APPLICATION 
 ID="objTest" 
 APPLICATIONNAME="HTA Test"
 SCROLL="no"
 SINGLEINSTANCE="yes"
>
</head>
<SCRIPT LANGUAGE="VBScript">

Sub TestSub

    Dim height
    Dim width
    height = h.Value
    width = w.Value

    myCMD = "CMD for /r ""C:\hta\photos\"" %%X in (*) do (""C:\hta\resize.exe"" -i""C:\hta\photos\%%~nX%%~xX"" -o""C:\hta\resized\%%~nX%%~xX"" -s800x600) PAUSE"

    Set WshShell = CreateObject("WScript.Shell")
    WshShell.exec(myCMD)

End Sub
</SCRIPT>
<body>
Width <input type="text" name="w" size="10" value="320"><br>
Height <input type="text" name="h" size="10" value="240"><br>
<input type="submit" name="" value="sub" onClick="TestSub">
</body>

推荐答案

我刚刚下载了 Resize.exe ,我做了一点批处理就可以在我的PC上对其进行测试,并且可以在5/5这批,我知道您已经标记了HTA,所以只需测试此批,我将尝试将其集成到HTA中.

I just downloaded the Resize.exe and i made a little batch to test it on my PC and it works 5/5 with this batch, i know you tagged for HTA, so just test this batch and i will try to integrate it on the HTA.

暂时尝试一下此批次:

@echo off
Title Batch Photos ReSizer
set RootFolder=C:\hta
set InputFolder=C:\hta\Photos\
set OutputFolder=%RootFolder%\Resized-photos
set /p Width=Choose the Width :  
set /p Height=Choose the Height : 
echo.
echo You have choosen to resize your photos in this resolution %Width%x%Height%
echo.
pause
echo. & echo Resizing photos is in Progress ...
if not exist %OutputFolder% MD %OutputFolder%
for /r %InputFolder% %%A in (*) do ("C:\hta\resize.exe" -i"%InputFolder%\%%~nxA" -o"%OutputFolder%\%%~nxA" -s%Width%x%Height%)
pause
Start Explorer "%OutputFolder%"

这篇关于简单的HTA脚本可调整照片文件夹的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 17:31