JeffQOOQAAA

Run a .bat file

13 posts in this topic

Hi

I have a problem ,  if description not clearly , please bear with me, thanks.

I run a bat file and use command _RunDos(@ScriptDir & "\HLK_Filter.bat") 

But will show "press any key to continue" the end (this information is bat file default setting.... )

I want to know , May I use auto it command for this instruction and close command window.......

 

 

Share this post


Link to post
Share on other sites



If you show your batch script, then this forum can help you more.^_^

Share this post


Link to post
Share on other sites

Hi All

My batch script is there 

@echo off
:: Filter updater for HCK and HLK
:::::::::::::::::::::::::: Settings :::::::::::::::::::::::::::::::::
:: Notice: As of July 2015, the HCK and the HLK filter updates are the exact same file, downloaded from the same location!
SET "source=https://sysdev.microsoft.com/member/SubmissionWizard/LegalExemptions/HCKFilterUpdates.cab"

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

SET "destination=C:\FilterUpdates.cab"

if not exist "%DTMBIN%\" (
    echo ERROR: folder "%DTMBIN%"
    echo does not exist! Please verify that you have the controller installed.
    exit /B 1
)

echo Please make sure that all instances of the Studio are turned OFF!


echo Downloading Filters...
bitsadmin /transfer "Downloading Filters" "%source%" "%destination%"
if not errorlevel 0 echo ERROR & exit /B 1
echo Extracting...
expand -i "%destination%" -f:UpdateFilters.sql "%DTMBIN%\"
if not errorlevel 0 echo ERROR & exit /B 1
echo Installing...
pushd "%DTMBIN%\"
if not errorlevel 0 echo ERROR & exit /B 1
"%DTMBIN%\updatefilters.exe"
if not errorlevel 0 echo ERROR & exit /B 1
popd

Share this post


Link to post
Share on other sites

You could try something like this:
nb: You'll need to update the $DTMBIN variable folder path

#include <InetConstants.au3>
    Local $DTMBIN = ''
    Local $sFilePath = "C:\FilterUpdates.cab"

    ; Download the file in the background with the selected option of 'force a reload from the remote site.'
    Local $hDownload = InetGet("https://sysdev.microsoft.com/member/SubmissionWizard/LegalExemptions/HCKFilterUpdates.cab", $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)

    Do
        Sleep(250)
    Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE)

    ; Close the handle returned by InetGet.
    InetClose($hDownload)
    RunWait(@ComSpec & ' /c expand -i "' & $sFilePath & '" -f:UpdateFilters.sql "' & $DTMBIN & '"', '', @SW_HIDE)
    RunWait($DTMBIN & '\UpdateFilters.exe', '', @SW_HIDE)
    MsgBox(0,'', 'Finished')

 

Share this post


Link to post
Share on other sites

@Subz

You can refer attachment

"press any key to continue"  is Applying updateFilte.sql default the end.

I want to use this bat file and the end  use autoit send key.......

S__23593005.jpg

Share this post


Link to post
Share on other sites

Can you run UpdateFilters.exe /? in the command line does it have any switches to override the pause?

If not the only method I can think of is either using ControlSend or maybe using something like this (untested):

RunWait(@ComSpec & ' /c "' & $DTMBIN & '\UpdateFilters.exe" & @Echo Done', '', @SW_HIDE)

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

49 minutes ago, JeffQOOQAAA said:

@Subz

You can refer attachment

"press any key to continue"  is Applying updateFilte.sql default the end.

I want to use this bat file and the end  use autoit send key.......

 

Why did you take a picture using your phone....? There is a "Print Screen" button on your keyboard, or use the snipping tool lol

Edited by InunoTaishou

Share this post


Link to post
Share on other sites

#10 ·  Posted

@Subz

Only run updatefilter.exe just show press any key continue.

It's updateFilter.exe default information, I want to skip it.....

 

Share this post


Link to post
Share on other sites

#11 ·  Posted

So did you run updatefilter.exe /?

 

Share this post


Link to post
Share on other sites

#12 ·  Posted

Sorry, I don't know your mean?

You mean is excuete updatefilter.exe directly?

 

 

Share this post


Link to post
Share on other sites

#13 ·  Posted

Correct from a command prompt using updatefilter.exe /?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now