Solved

search vbscript error and advice

Posted on 2013-12-19
1
417 Views
Last Modified: 2013-12-20
I was given some vb code (not my area at all) to copy certain text files to another location if they contain a keyword. Basically Ihave a folder full of text files, but I want to copy all the text files that contain a certain keyword to another folder.

the code provided was:

setlocal enabledelayedexpansion
for /r C:\originalresults %%a in (*.txt) do (
find "back" "%%a"
if !errorlevel!==0 copy "%%a" "C:\users\me\Desktop\results" /y
) 

Open in new window


Now when I run this script i.e. from command prompt

cscript thisscripts.vbs I get an error "expected identifier", can anyone assist in where I am going wrong?
0
Comment
Question by:pma111
1 Comment
 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
Comment Utility
That's not VB code; it's a shell script. Rename the extension to ".bat" and try running the file again (i.e. double-click the file; no cscript involved).
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

743 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now