Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

vbs script to  run external executable and move file

Posted on 2006-10-23
3
Medium Priority
?
906 Views
Last Modified: 2012-05-05
Hello,

Would you please help me?

I need batch file that will run on Windows XP PC, but not with command prompt but background.
I have no single experience on vbs but I learned from Experts log that vbs can run in background....

What I need to do....
1) check file *yyyymmdd.txt exist or not, if not, exit  (yyyymmdd is today's date)
2) run external executable (written in C++) to this particular file with passing the file name as valuable.
3) check if directory called "Archive" exists or not, if not, create the directory
4) move the *yyyymmdd.txt into Archive


Would somebody help me on this?
0
Comment
Question by:sleepingluke
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 22

Expert Comment

by:cj_1969
ID: 17787995
Being a vb script you have 2 ways to run this ... cscript or wscript
cscript runs it ina command-line type window and wscript will run it in a windows environment.
BUT from your question, I get the feeling that you want cscript, you just don't want to have to run it manually, you want it to execute and stay running, without being on the desktop ... if so, then you probably want to look at running it as a service.

Check out this page ... it should have all the info you need for this ... http://support.microsoft.com/kb/q137890/
0
 
LVL 22

Accepted Solution

by:
cj_1969 earned 1000 total points
ID: 17788221
I think to do what you want, all you need is a batch file and use the schedule command.
If you specify an alternate ID for the job to run under then it will not appear on the desktop, it will run in the background.
Also, since this is a daily file, it doesn't make sense to have something running constantly when it just needds to run once a day.
Try the following and see if this, in addition to the scheduled job, does what you need ...

copy the contents between the lines into a file with a .cmd extenstion and modify the lines that are noted to be customized
-------------------------------------------------
@echo off

REM *** ENVIRONMENT VARIABLES, INITIALIZE VALUES
for /F "tokens=1,2" %%a in ('DATE /T') do SET sysDate=%%b
SET sysMonth=%sysDate:~0,2%
SET sysDay=%sysDate:~3,2%
SET sysYear=%sysDate:~6,4%
SET FileName=%sysYear%%sysMonth%%sysDay%.txt

REM *** Change Source File Directory Reference
SET dirPath=.\
SET DailyFile=%dirPath%%FileName%

REM *** Change Archive Directory Reference
SET ArchiveDirectory=.\Archive\

REM *** Change Executable Application Reference
SET ExecutableApplication="c:\program files\some application\thisApp.exe"


REM *** Check to see if the file exists
if exist %DailyFile% (
  call %ExecutableApplication% %DailyFile%
  mkdir %ArchiveDirectory%
  copy /Y %DailyFile% %ArchiveDirectory%%FileName%
)
-------------------------------------------------
0
 

Author Comment

by:sleepingluke
ID: 17792528
Hi, cj 1969,

Thank you very much, it works very well!!!!!

:-D appreciated!!!

sleepingluke

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is only natural that we all want our PCs to be in good working order, improved system performance, so that is exactly how programs are advertised to entice. They say things like:            •      PC crashes? Get registry cleaner to repair it!    …
Sometimes people don't understand why download speed shows differently for Windows than Linux.Specially, this article covers and shows the solution for throughput difference for Windows than a Linux machine. For this, I arranged a test scenario.I…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question