Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27348

How to know file path of a vbs file running in wscript by vb.net?

$
0
0
Hello Friends,
I'm able to get running process list by the following code:

Code:

For Each p As Process In Process.GetProcesses()
 Msgbox p.Modulename
Next

I'm running a vbs file from the desktop by double-click on it. In the process list it is showing as "WScript.exe".

I want to know the vbs file path which is running in Wscript.exe. How can I do that in vb.net?

I tried WMI also (as code given below), but not getting success.

Code:

Dim searcher As New ManagementObjectSearcher( _
  "SELECT * FROM Win32_Process WHERE Name='WScript.exe'")

For Each process As ManagementObject in searcher.Get()
Msgbox process("CommandLine") 'it is showing a blank messagebox
Next

Any idea about How to get what file is running in wscript.exe or cscript.exe?

Sorry for my Bad English !

Regards,

Viewing all articles
Browse latest Browse all 27348

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>