Solved

search vbscript error and advice

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Make the most of your online learning experience.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Simple Linear Regression

688 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