?
Solved

search vbscript error and advice

Posted on 2013-12-19
1
Medium Priority
?
425 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
[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
1 Comment
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 2000 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Simple Linear Regression
Suggested Courses

752 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