Solved

search vbscript error and advice

Posted on 2013-12-19
1
421 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 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39728965
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 …
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

820 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