Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

WMI Event Watcher

Posted on 2012-03-19
5
Medium Priority
?
228 Views
Last Modified: 2012-06-27
how do i replace the folder name with a variable.
"Win32_Directory.Name=\"c:\\\\Development\\\\temp\""


like.
Win32_Directory.Name=\"@Correct_File""
0
Comment
Question by:aneilg
[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
  • 3
  • 2
5 Comments
 
LVL 40

Accepted Solution

by:
lcohan earned 1160 total points
ID: 37738834
If you mean by SQL code please see below:


declare @string varchar(max),
            @path varchar(255)

set @path = '"c:\\\\Development\\\\temp\"'
SET @string = '"Win32_Directory.Name=\' + @path

print (@string);
0
 
LVL 40

Expert Comment

by:lcohan
ID: 37738856
If you need this at the OS level in CMD or batch file you should use parameters like %1, %2, ...
So in the batch or command file would be something like:



"Win32_Directory.Name="%1

Where %1 = \"c:\\\\Development\\\\temp\""
0
 

Author Comment

by:aneilg
ID: 37741356
sorry for the Confusion, but i am using the WMI Event Watcher Task, and its WMI Options, WqlQuerySource.
0
 
LVL 40

Expert Comment

by:lcohan
ID: 37744359
OK, so you have two options in my opinion - if you have the WQL query you can modify it as I mentioned above with the sql example using variables or if you have it in SSIS task you can add task parameter/value:

http://www.simple-talk.com/sql/ssis/passing-variables-to-and-from-an-ssis-task/
http://msdn.microsoft.com/en-us/library/cc280502.aspx
0
 

Author Closing Comment

by:aneilg
ID: 37786872
thanks
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

I have written a PowerShell script to "walk" the security structure of each SQL instance to find:         Each Login (Windows or SQL)             * Its Server Roles             * Every database to which the login is mapped             * The associated "Database User" for this …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

618 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