Adding vbs yes/no box code to a batch file - batch-file

I am trying to add the following yes/no box into a batch file but keep failing.
Set objShell = CreateObject("Wscript.Shell")
intMessage = Msgbox("Would you like to go to URL?", _
vbYesNo, "Click yes to go to URL")
If intMessage = vbYes Then
objShell.Run("http://www.url.com")
Else
Wscript.Quit
End If
Can anyone point me in the right direction please?

#echo off
call :MsgBox "Would you like to go to URL?" "VBYesNo+VBQuestion" "Click yes to go to URL"
if errorlevel 7 (
echo NO - don't go to the url
) else if errorlevel 6 (
echo YES - go to the url
start "" "http://www.google.com"
)
exit /b
:MsgBox prompt type title
setlocal enableextensions
set "tempFile=%temp%\%~nx0.%random%%random%%random%vbs.tmp"
>"%tempFile%" echo(WScript.Quit msgBox("%~1",%~2,"%~3") & cscript //nologo //e:vbscript "%tempFile%"
set "exitCode=%errorlevel%" & del "%tempFile%" >nul 2>nul
endlocal & exit /b %exitCode%

Although there are several methods to include vbs code into a Batch file, all of them are clumsy, but you may google for they if you want.
May I suggest a different solution?
The inclusion of JScript code into a Batch file is simpler than VBScript, and the translation of a small code segment from VBS to JScript is not problematic. For example:
#if (#CodeSection == #Batch) #then
#echo off
rem Execute the JScript code:
CScript //nologo //E:JScript "%~F0"
goto :EOF
#end
// JScript code start here
objShell = WScript.CreateObject("WScript.Shell")
// http://msdn.microsoft.com/en-us/library/x83z1d9f.aspx
intMessage = objShell.Popup("Would you like to go to URL?",0,"Click yes to go to URL",4)
if (intMessage == 6)
objShell.Run("http://www.url.com")
else
WScript.Quit()
//endif

I found this code on the Net, perhaps it can help you !
::'.#FILE: .#This: NTFunID031.cmd #Date: 2014-04-17 .#Note: NTMaxToolsPlay ID 031
::'.#SUMMARY: .#Note: cmd+vbs, all in one .#INFO: .#File: NTFunID031_readme.txt
::'.#PROJECT_NAME: .#Parent: NTMaxTools .#AUTHOR: .#Name: NT
::'.
::'.
::response= MsgBox("Are you okay ?", vbYesNo+vbQuestion, "Hello ! ;)")
rem assign response to exit code
::wscript.quit(response)
call break '& #echo off& cls& echo.& echo.
call break '& title : -- Real all in one [cmd+vbs], NTMaxToolsPlay, just for the fun ;)
call break '& echo Hi!
call break '& wscript //e:vbs //nologo "%~f0"
call break '& set /a rep=%errorlevel%
call break '& if %rep% equ 6 echo Yesssssssssss, me too :p
call break '& if %rep% equ 7 echo Oh Nonnn :'(
call break '& echo.& pause

Related

How can i run the window of the started program minimized

i want to run a .wav-file. This is with
start "" SoundFile.wav
totally practical. But how can i run the window of the standard-windows-soundplayer minimized? So that nothing of my view changes?
start "" SoundFile.wav /MIN
start "" SoundFile.wav /min
start "" SoundFile.wav -MIN
start "" SoundFile.wav -min
didn't work sadly.
Can you help me?
Greets.
Sorry but i am not familiar with stackoverflow, so i can't make it that understandable, but i hope that this is enough.
In a simple way, you could just use a VBS like this:
s = createobject("WScript.Shell")
s.run "music.mp3", 2
Or create an automatic and CLI program to do this:
runmusic.bat
#echo off
set music=%1
set music=%music:"=%
if ":" neq "%music:~1,1%" set music=%cd%\%music%
if "%music:~-4%" neq ".mp3" set music=%music%.mp3
set katorn=%random%
echo >>"%temp%\%katorn%.vbs" set s = createobject("WScript.Shell")
echo >>"%temp%\%katorn%.vbs" s.run "%music%", 2
cscript "%temp%\%katorn%.vbs"
:: Uncomment the next line to autodelete the vbs file.
:: del /q /f "%temp%\%katorn%.vbs"
Usage:
runmusic (name or full path with quotation marks)
In a "professional way" you could do a shortcut file that starts the file minimized.
It could be useful if you needs the musics to have the "artist logo" or something like that, also if you don't want to use an CMD all the time...
Delete all comments to execute.
Set WshShell = CreateObject ("Wscript.Shell")
strDesktop = "X:\Shortcutlocation\yoo"
Set Shortcut = WshShell.CreateShortcut(strDesktop + "\MusicNameMaybe.lnk")
Shortcut.WindowStyle = "7"
Shortcut.IconLocation = "X:\IconPath\youricon.ico" // You can delete this and the file will be the same ever and forever.
Shortcut.TargetPath = "X:\yourpath\music.mp3"
Shortcut.Save
And you don't have to keep the shortcuts on the desktop if you don't want to, you don't even have to keep them fixed. Example:
runmusic.bat
#echo off
set music=%1
set music=%music:"=%
if ":" neq "%music:~1,1%" set music=%cd%\%music%
set music=%music%.mp3
set katorn=%random%
echo >>"%temp%\%katorn%.vbs" Set WshShell = CreateObject ("Wscript.Shell")
echo >>"%temp%\%katorn%.vbs" strDesktop = "%temp%"
echo >>"%temp%\%katorn%.vbs" Set Shortcut = WshShell.CreateShortcut(strDesktop + "\%katorn%.lnk")
echo >>"%temp%\%katorn%.vbs" Shortcut.WindowStyle = "7"
echo >>"%temp%\%katorn%.vbs" Shortcut.TargetPath = "%music%"
echo >>"%temp%\%katorn%.vbs" Shortcut.Save
cscript "%temp%\%katorn%.vbs"
:: Uncomment the next two lines to delete the temporary files.
:: del /q /f "%temp%\%katorn%.vbs"
:: del /q /f "%temp%\%katorn%.lnk"
echo Enjoy!
Usage:
runmusic (name or full path with quotation marks)
Now that you understand, you can even leave a folder with the songs and the other with just the customized shortcuts, which can come in handy.
Hope this helps,
K.

How to Pass a Variable Between Batch and VBS?

I have made a perfect square number finder that starts from 1 and the code is below. However, I need a way to pass variables between batch and vbscript (VBS has a better UI). I am stuck at this point, how do I send a variable between a batch and vbscript? If anything maybe have the vbscript print a number into a file then the batch script reads the file and the number in it then deletes it.
#echo off
title Perfect Squares without paste to file
cls
set /a num=3
set /a num1=1
echo 1
:1
set /a num2=%num1%+%num%
echo %num2%
echo %num2%
set /a num1=%num2%
set /a num=%num%+2
goto 1
You can run a VBScript from a batch file like this (the parameter //NoLogo prevents the interpreter from printing the version/copyright banner all the time):
cscript //NoLogo C:\your.vbs 23
Use the Arguments property for receiving the argument (23) in the VBScript:
value = WScript.Arguments(0)
and pass a value back to the batch script via the return value:
WScript.Quit 42
Example:
VBScript code:
value = WScript.Arguments(0)
WScript.Quit value + 19
Batch code:
#echo off
cscript //NoLogo C:\your.vbs %1
echo %errorlevel%
Output:
C:\>batch.cmd 23
42
C:\>batch.cmd 4
23
If you need to pass text back and forth, passing the response back to the batch script becomes more complicated. You'll need something like this:
for /f "tokens=*" %%r in ('cscript //NoLogo C:\your.vbs %1') do set "res=%%r"
Example:
VBScript code:
str = WScript.Arguments(0)
WScript.StdOut.WriteLine str & " too"
Batch code:
#echo off
setlocal
for /f "tokens=*" %%r in ('cscript //NoLogo C:\your.vbs %1') do set "res=%%r"
echo %res%
Output:
C:\>batch.cmd "foo"
foo too
C:\>batch.cmd "and some"
and some too
On a more general note: why do you use batch/VBScript in the first place? PowerShell is far more versatile than both of them combined, and is available for any halfway recent Windows version.

Launch a Java/Batch hybrid without displaying command prompt

A little while I asked a question (and got a brilliant response) to create the program below, what I'd like to is silently launch it, so the command prompt does not display in the background.
The program below tests for "Agent.exe" and if it finds it, displays a message box to the user telling them the program will close in 2 minutes unless they press ok.
now
I came across this VBS script
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "Program goes here" & Chr(34), 0
Set WshShell = Nothing
but have not the tiniest clue to combine it with my script
#if (#CodeSection == #Batch) #then
setlocal
for /f %%I in ('forfiles /p "%~dp0." /m "%~nx0" /c "cmd /c echo 0x07"') do set "beep=%%I"
set /P "=%beep%"<NUL
set /P "=%beep%"<NUL
set /P "=%beep%"<NUL
setlocal
set "task=agent.exe"
set "timeout=120"
rem // Is %task% running?
tasklist /fi "imagename eq %task%" | find /i "%task%" >NUL && (
rem // Re-launch script with JScript interpreter
wscript /e:JScript /nologo "%~f0" %timeout% || (
rem // If timeout or user hits No, kill %task%
taskkill /im "%task%" /f
)
)
rem // End main runtime
goto :EOF
rem // Begin JScript portion
#end
var osh = WSH.CreateObject('WScript.Shell'),
nag = 'Greetings! Your administrator has requested you to log out of Program '
+ 'after work. It appears you are still using it.'
+ ' If you are still here, Press Yes to continue working.\n\n'
+ 'Otherwise, press no to close Program.'
+ 'Program will close automatically in less than ' + WSH.Arguments(0) + ' seconds.';
popup = osh.Popup(nag, WSH.Arguments(0), 'Are you still here?', 0x4 + 0x20 + 0x1000);
WSH.Quit(popup - 6);
Anyone have any ideas?
(shoutout to Rojo, who answered my initial Question with the above script)
To answer your question, that VBScript snippet will work. Just save it with a .vbs extension and replace "Program goes here" with the path + filename of your batch script. When you double-click the vbs file or execute it with wscript /nologo "path\to\vbsfile", it will run the batch script hidden (no console window) but the popup will still appear.
If you'd prefer to keep all your code within a single file, you could invoke powershell -windowstyle hidden to hide the window. You'll still see the black window for a second, but it'll disappear before the popup appears.
#if (#CodeSection == #Batch) #then
setlocal
rem // hide current window
powershell -windowstyle hidden -command ""
for /f %%I in ('forfiles /p "%~dp0." /m "%~nx0" /c "cmd /c echo 0x07"') do set "beep=%%I"
set /P "=%beep%"<NUL
set /P "=%beep%"<NUL
set /P "=%beep%"<NUL
set "task=agent.exe"
set "timeout=120"
rem // Is %task% running?
tasklist /fi "imagename eq %task%" | find /i "%task%" >NUL && (
rem // Re-launch script with JScript interpreter
wscript /e:JScript /nologo "%~f0" %timeout% || (
rem // If timeout or user hits No, kill %task%
taskkill /im "%task%" /f
)
)
rem // if not in a self-destructing window, re-show
set "caller=%cmdcmdline:"=%"
if /I not "%caller:~0,6%"=="cmd /c" powershell -windowstyle normal -command ""
rem // End main runtime
goto :EOF
rem // Begin JScript portion
#end
var osh = WSH.CreateObject('WScript.Shell'),
nag = 'Greetings! Your administrator has requested you to log out of the Cisco '
+ 'Agent Desktop after work. It appears you are still using it. If you '
+ 'are still here, Press Yes to continue working.\n\n'
+ 'Otherwise, press No to close the agent. Agent will close automatically '
+ 'in less than ' + WSH.Arguments(0) + ' seconds.',
popup = osh.Popup(nag, WSH.Arguments(0), 'Are you still here?', 0x4 + 0x20 + 0x1000);
WSH.Quit(popup - 6);
Shout received and appreciated. I still think you ought to play a cheesy midi file instead of beeping. :)

Batch File to Convert DOC Files to TXT [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I Have batch code listed in a password protected word file (so no one can edit my code) and i need a .bat file that can convert the code i have listed in there, to a .txt file that i can have it read. If you know a way to make a .bat file that can read a word doc, that would also be appreciated.
Using a (tested) hybrid batchscript (that encapsulates JScript):
#if (0)==(1) REM BatchScript:
:INIT
#ECHO OFF & CLS
SET DOC=C:\Some folder\tst.doc
SET TXT=C:\Some other folder\res.txt
SET PWD=MySecretPass
:MAIN
cscript //NoLogo //E:JScript "%~f0" /inp:"%DOC%" /outp:"%TXT%" /pass:"%PWD%"
notepad "%TXT%"
GOTO ENDBAT
:ENDBAT
ECHO Press any key to exit...&PAUSE>NUL
GOTO :EOF
#end // JScript:
var FSO = WScript.CreateObject("Scripting.FileSystemObject")
, HND = FSO.CreateTextFile(WScript.Arguments.Named('outp'))
, APP = WScript.CreateObject('Word.Application')
, DOC, str
;
APP.Visible=false; //hide word
DOC = APP.Documents // access interface
.Open( WScript.Arguments.Named('inp') //file location
, false //ConfirmConversions
, true //ReadOnly
, false //AddToRecentFiles
, WScript.Arguments.Named('pass') || '' //PasswordDocument
//, //PasswordTemplate
//, //Revert
//, //WritePasswordDocument
//, //WritePasswordTemplate
//, //Format
//, //Encoding
//, //Visible
//, //OpenConflictDocument
//, //OpenAndRepair
//, //DocumentDirection
//, //NoEncodingDialog
);
str=new String(DOC.Content); //grab content
str=str.replace(/\r\n|\r/g,'\r\n')+'\r\n'; //cleanup line-endings
HND.Write( str ); //write the file
HND.Close(); //close file handle
DOC.Close(); //close word doc
APP.quit(0); //don't forget to close word
Save this as a batchscript, replacing the hardcoded inputfile DOC, outputfile TXT and password PWD. See npocmaka's answer to alter this to accepting arguments on the batchscript call.
Instead of running the resulting txt-file through notepad you might want to call the batchscript directly.
Also you might want to delete the extracted batchfile under the :ENDBAT label.
Also, (to keep it simple and to the core) there is no error-checking provided.
Lastly, it requires MS Word (starting at Office 2000) to be installed.
Usage: simply run it however you please.
UPDATE:
After comparing notes and doing tests in the chat, npocmaka and I concluded that if one uses word's SaveAs, the safest bet is using type 2: wdFormatText. More about that in npocmaka's updated answer.
My example (writing a new file using the FileSystemObject) shows a simpler way of post-processing the fetched text and doesn't update word's internal recent file-list (MRU) that otherwise would be updated when word converts saves the file.
Between the both of our answers there is plenty to choose from, so happy mixing!
See this page:
http://www.abisource.com/wiki/AbiCommand
which describes using the command line options available for AbiWord, including
converttotext "file\path\file.doc" "destingation\file.txt"
(http://www.abisource.com/download/index.phtml)
A smaller install would probably be http://wvware.sourceforge.net/#wv, but apparently the developer considers those utilities to be "deprecated" and probably not as reliable as using AbiWord.
This just in: see http://github.com/tobya/DocTo
Here's a script that I've wrote long ago to save doc(x) to txt. And this is a reworked version that accepts a password:
'>nul 2>&1|| #copy /Y %windir%\System32\doskey.exe '.exe >nul
'&&#echo off && cls &&goto :end_vbs
Set WordApp = CreateObject("Word.Application")
WordApp.Visible = FALSE
'Open doc for reading
Set WordDoc = WordApp.Documents.Open(WScript.Arguments.Item(0),true,true,false,WScript.Arguments.Item(2))
'wdFormatText 2
'wdFormatUnicodeText 7
format = CInt(WScript.Arguments.Item(3) )
WordDoc.SaveAs WScript.Arguments.Item(1) ,format
WordDoc.Close()
WScript.Quit
:end_vbs
'& if "%~1" equ "-help" echo %~n0 word_document destination password [-unuicode]
'& if "%~1" equ "" echo word document not given & exit /b 1
'& if not exist "%~f1" echo word document does not exist & exit /b 2
'& if "%~2" equ "" echo destination not given & exit /b 1
'& set "save_as=%~2"
'& if exist "%~f2" del /s /q "%~f2"
'& if "%~4" equ "-unuicode" ( set "format=7") else ( set "format=2")
'& taskkill /im winword* /f >nul 2>&1
'& cscript /nologo /E:vbscript %~f0 "%~f1" "%save_as%" "%~3" %format%
'& pause
'& del /q /f '.exe
This is a batch/vbscript hybrid and you need to save it as a .bat
Note - will need admin permissions to start "invisible" word application.
An example (if file is saved as doc2txt.bat) (it's better to use full paths):
doc2txt.bat c:\tstpass.docx c:\result\tstpass.txt super_secret_password
doc2txt.bat c:\tstpass.docx c:\result\tstpass.txt super_secret_password -unicode
EDIT jscript/bat hybrid
#if (#x)==(#y) #end /***** jscript comment ******
#echo off
if "%~1" equ "-help" echo %~n0 word_document destination password [-unuicode|-breaks]
if "%~1" equ "" echo %~n0 word_document destination password [-unuicode]
if "%~2" equ "" echo destination not given & exit /b 1
if "%~3" equ "" echo password not given & exit /b 3
if exist "%~f2" del /s /q "%~f2"
if "%~4" equ "-unicode" (
set "format=7"
) else (
if "%~4" equ "-breaks" (
set "format=3"
) else (
set "format=2"
)
)
:: kill winword application to avoid collisions
taskkill /im winword* /f >nul 2>&1
if not exist "%~f1" echo word document does not exist & exit /b 2
cscript //E:JScript //nologo "%~f0" "%~f1" "%~2" %~3 %format%
exit /b 0
***** end comment *********/
var source_file=WScript.Arguments.Item(0);
var destination_file=WScript.Arguments.Item(1);
var confirmConv=false;
var readOnly=true;
var addToRecentFiles=false;
var password=WScript.Arguments.Item(2);
//save format enumaration - http://msdn.microsoft.com/en-us/library/office/ff839952.aspx
// text formats
//wdFormatText 2
//wdFormatUnicodeText 7
//wdFormatTextLineBreaks 3
var encoding=parseInt(WScript.Arguments.Item(3));
var WordApp=new ActiveXObject("Word.Application");
WordApp.Visible = false;
var WordDoc=WordApp.Documents.Open(source_file,confirmConv,readOnly,addToRecentFiles,password);
WordDoc.SaveAs(destination_file,encoding);
WordDoc.Close();
WScript.Quit();
examples:
doc2txtjs.bat "c:\tstpass.docx" "c:\result\tstpass.txt" unhackable_password -breaks
doc2txtjs.bat "c:\tstpass2.docx" "c:\result\tstpass2.txt" unhackable_password -unicode
doc2txtjs.bat "c:\tstpass3.docx" "c:\result\tstpass3.txt" unhackable_password
-breaks/-unicode will save the file respectively with preserved line breaks or in unicode format.You'll need admin permissions again.But as you want to create a bat from doc you dont need to use these additional options.
I figured it out. I made a batch program that creates a temporary VBS file that converts it to a BAT file instead of a TXT. Then I executed the Batch file from the converter. Thanks for all your answers though and I saw some useful ideas. :)

I'm trying to make an auto-updating .bat program

So, how I have it done right now, is that it that it calls another bat file to update it, and then that batch file updates, and sets %ERRORLEVEL% to 1. At the start of the original program, it checks if errorlevel is 1, if yes, it goes to the main menu, but right now, it doesn't call the update file, it just goes to the menu. This is my code
Main program
IF %errorlevel% EQU 1 goto begin
call updater.bat
:begin
echo MENU
Updater
set=errorlevel 1
wget (updatelink here)
call mainprogram.bat
Right now, sometimes it works, sometimes it doesn't, which leads me to believe that some command is somehow increasing the errorlevel, but the only code before the errorlevel check is
#echo off
color 0f
cls
set currentver=v0.5.6
(check code)IF %errorlevel% EQU 1 goto begin
https://code.google.com/p/flashcart-helper/source/browse/trunk/0.6/FlashcartHelperRobocopy.bat
Here is what I have right now.
Don't play around with errorlevel. It's an internal variable. At the start of a batch, errorlevel will be 0 because all you've done is set a local variable. This will almost always ( never say never ) succeed. Also, if errorlevel is 1, and I'm reading this correctly you also seem to have an infinite loop? From what I understand of what you've said your batches are like this:
Main
#echo off
color 0f
cls
set currentver=v0.5.6
IF %errorlevel% EQU 1 goto begin
call updater.bat
:begin
echo MENU
Updater
set=errorlevel 1
wget (updatelink here)
call mainprogram.bat
As errorlevel get's overwritten each time you do anything you're asking for trouble. Change %errorlevel% to %error% and it should solve your problems. As it's a local environment variable it should also be passed between batch files. Just be careful not to use error elsewhere.
Here is a solution using Dropbox Public Folders and no wget. It uses PowerShell that in on Win7+ machines.
Update the below https://dl.dropboxusercontent.com/u/12345678/ url with your own.
It auto creates a .conf file for configuration.
Set __deploy_mode to 1 for the file on dropbox so the version file can be updated but the script not accidentally executed.
#ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
SET time_start=%time%
SET time_choice_wait=20
SET script_ver=1.00
SET script_name=%~n0
SET server_url=https://dl.dropboxusercontent.com/u/12345678/
SET script_name_bat=%~dp0%script_name%.bat
SET script_name_cfg=%~dp0%script_name%.conf
SET script_name_latest_ver=%~dp0%script_name%.latest.ver
ECHO %script_name% v%script_ver%
ECHO %script_ver% > %script_name%.current.ver
IF NOT EXIST "%script_name_cfg%" CALL :SCRIPT_MISSING_CFG
FOR /f "delims=" %%x IN (%script_name%.conf) DO (SET "%%x")
IF %__deploy_mode% EQU 1 GOTO :EOF
IF %auto_update_compare% EQU 1 CALL :SCRIPT_COMPARE_VER
:SCRIPT_MAIN
REM =======================================
REM === EDIT BELOW THIS LINE ==
REM TODO Add main content
ECHO.
ECHO Waiting for content...
REM === EDIT ABOVE THIS LINE ==
REM =======================================
GOTO END
:SCRIPT_MISSING_CFG
ECHO Creating new %script_name%.conf file...
ECHO __deploy_mode=0 > "%script_name_cfg%"
ECHO repository_base_url=%server_url% >> "%script_name_cfg%"
ECHO auto_update_compare=1 >> "%script_name_cfg%"
ECHO auto_update_download=1 >> "%script_name_cfg%"
ECHO Update %script_name%.conf as needed, then save and close to continue.
ECHO Waiting for notepad to close...
NOTEPAD "%script_name_cfg%"
GOTO :EOF
:SCRIPT_COMPARE_VER
ECHO Please wait while script versions are compared...
Powershell -command "& { (New-Object Net.WebClient).DownloadFile('%server_url%%script_name%.current.ver', '%script_name_latest_ver%') }"
IF NOT EXIST "%script_name_latest_ver%" GOTO END
SET /p script_latest_ver= < "%script_name_latest_ver%"
IF %script_ver% EQU %script_latest_ver% CALL :SCRIPT_COMPARE_VER_SAME
IF %script_ver% NEQ %script_latest_ver% CALL :SCRIPT_COMPARE_VER_DIFF
GOTO :EOF
:SCRIPT_COMPARE_VER_SAME
ECHO Versions are both %script_name% v%script_ver%
GOTO :EOF
:SCRIPT_COMPARE_VER_DIFF
ECHO Current Version:%script_ver% ^| Server Version:%script_latest_ver%
IF %auto_update_download% EQU 1 GOTO SCRIPT_DOWNLOAD_SCRIPT
ECHO.
ECHO Would you like to download the latest %script_name% v%script_latest_ver%?
ECHO Defaulting to N in %time_choice_wait% seconds...
CHOICE /C YN /T %time_choice_wait% /D N
IF ERRORLEVEL 2 GOTO SCRIPT_DOWNLOAD_NOTHING
IF ERRORLEVEL 1 GOTO SCRIPT_DOWNLOAD_SCRIPT
IF ERRORLEVEL 0 GOTO SCRIPT_DOWNLOAD_NOTHING
:SCRIPT_DOWNLOAD_SCRIPT
ECHO Please wait while script downloads...
Powershell -command "& { (New-Object Net.WebClient).DownloadFile('%server_url%%script_name%.bat', '%script_name_bat%') }"
ECHO Script Updated to v%script_latest_ver%^^!
REM User must exit script. Current batch is stale.
GOTO :END
:SCRIPT_DOWNLOAD_NOTHING
GOTO :EOF
:END
SET time_end=%time%
ECHO.
ECHO Script started:%time_start%
ECHO Script ended :%time_end%
:END_AGAIN
pause
ECHO.
ECHO Please close this window
ECHO.
GOTO END_AGAIN
You can do that through these steps:
1.put two files in server,a config file, a higher version bat file which need to update; set last version num. in config file.
2.client bat should be checked update at every startup time. you can read the news version in server config file, then compared to local bat file version. if not equal, so do update, else other wise.
Do you have any problems?

Resources