Scripts Thread, .bat script in Coding and Web Development; Hi, just looking for nsome help, I am writing a small backup script. I have the code to copy the ...
-
23rd November 2009, 01:09 PM #1 .bat script
Hi, just looking for nsome help, I am writing a small backup script. I have the code to copy the source to the destination and it works well. I was just wondering if after my copy command had run there is any way to send a notification box?
I have the box written in .vbs and have tried to call it in the bat file but it comes as the script starts...
I guess what I'm asking is,
Is there any way to get a process to wait for a previous process to finish in a bat file?
-
-
IDG Tech News
-
23rd November 2009, 01:13 PM #2 Stick in a conditional statement or a flag file to look for and loop it........
Use 'for' if using batch.
http://www.robvanderwoude.com/for.php
Last edited by mattx; 23rd November 2009 at 01:20 PM.
-
-
23rd November 2009, 01:16 PM #3 If you put a call to cscript/wscript to run the VBS after the line with the copy command it shouldn't execute till the copy command is finished. The bat file should run line by line, the previous line isn't usually considered finished until the program it has launched has exited - the exception being if you use a 'start' at the start of the line to launch a program without waiting... You don't have the vbs before the copy do you?
If you want the bat to exit after the copy is done and launch a notification without getting stuck in the background you'd want a 'start' at the start of the wscript line.
-
-
23rd November 2009, 02:24 PM #4 I have no idea what you mean...
could you write me an example please?
heres the code:
eventcreate /t information /id 998 /l application /d "Update.bat has started"
start /wait /b xcopy "C:\Documents and Settings\administrator\My Documents\*.*" "C:\Documents and Settings\administrator\Desktop\backup" /c /d /s /e /k /y /z /i
eventcreate /t information /id 998 /l application /d "Update.bat has finished"
call "C:\Documents and Settings\administrator\Desktop\success.vbs"
Thank you
-
-
23rd November 2009, 02:48 PM #5 Remove start /wait /b from the xcopy line...
-
-
23rd November 2009, 02:53 PM #6 
Originally Posted by
neon
I have no idea what you mean...
could you write me an example please?
heres the code:
eventcreate /t information /id 998 /l application /d "Update.bat has started"
start /wait /b xcopy "C:\Documents and Settings\administrator\My Documents\*.*" "C:\Documents and Settings\administrator\Desktop\backup" /c /d /s /e /k /y /z /i
eventcreate /t information /id 998 /l application /d "Update.bat has finished"
call "C:\Documents and Settings\administrator\Desktop\success.vbs"
Thank you
Think you have it already basically except where you've used start /wait /b I would do it directly within the batch file and log the output so you can check for errors later. It's probably this that's throwing the VBS up early?
My tweaked version of your script -
Code:
@echo off
eventcreate /t information /id 998 /l application /d "Update.bat has started"
REM removed start /wait /b from the line below, added a redirect for output to a log file with todays date
xcopy "C:\Documents and Settings\administrator\My Documents\*.*" "C:\Documents and Settings\administrator\Desktop\backup" /c /d /s /e /k /y /z /i > "C:\Documents and Settings\administrator\Desktop\backup\%date:~6,4%-%date:~3,2%-%date:~0,2%.log"
eventcreate /t information /id 998 /l application /d "Update.bat has finished"
REM added start wscript to the line below to allow the bat to exit whilst the message box is still open
start wscript "C:\Documents and Settings\administrator\Desktop\success.vbs"
-
SHARE:
Similar Threads
-
By RabbieBurns in forum Scripts
Replies: 1
Last Post: 20th November 2009, 03:05 AM
-
By Dos_Box in forum General Chat
Replies: 1
Last Post: 11th July 2008, 01:19 PM
-
By cookie_monster in forum MIS Systems
Replies: 10
Last Post: 11th February 2008, 01:28 PM
-
By robert.mabbutt in forum MIS Systems
Replies: 9
Last Post: 15th August 2007, 09:43 PM
-
By OverWorked in forum How do you do....it?
Replies: 2
Last Post: 21st September 2006, 12:59 PM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules