?
Solved

Passing a variable where select * wants a literal, VB6

Posted on 2004-08-11
3
Medium Priority
?
261 Views
Last Modified: 2012-05-05
Code:

For Each Process In GetObject("winmgmts:").ExecQuery("select * from Win32_Process where
Name='cmd.exe'")
        Process.Terminate
Next

I need to pass a variable to the Name= instead of a literal (here I put cmd.exe).  This should be easy but can't think of the answer. tried this no help:

Name='" & myVar)

0
Comment
Question by:bluedragon99
[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 1

Author Comment

by:bluedragon99
ID: 11774876
Need to pass process.name
0
 
LVL 7

Accepted Solution

by:
Tanglin05 earned 2000 total points
ID: 11774890
Did you try:

Name='"& myVar &"'")
0
 
LVL 1

Author Comment

by:bluedragon99
ID: 11774938
Perfect!  Thanks for the quick solution.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Make the most of your online learning experience.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
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…

777 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