- Aug
- 2,082
- 85
I wanted to know if I was running a .vbs (VBScript) file from either the TCC Script command, or CScript.exe.
The following .vbs (VBScript) file can be run from either the TCC Script command, or CScript.exe, to determine where the .vbs is running from.
Posting this mainly for my future reference, but thought others might also find this useful.
Joe
The following .vbs (VBScript) file can be run from either the TCC Script command, or CScript.exe, to determine where the .vbs is running from.
Code:
' VbsEdit Toolkit is part of VBSEdit.
Set tk = CreateObject( "VbsEdit.Toolkit" )
PID = tk.CurrentProcessID
PIDModule = tk.ModuleFilenameFromProcessId(PID)
if right(PIDModule,7) = "tcc.exe" then
with TakeCommand
.tcommand("echo The .vbs is running from SCRIPT in tcc.exe")
end With
else
with WScript
.StdOut.WriteLine "The .vbs is running from CSCRIPT.EXE"
end With
end if
Set tk = Nothing
Posting this mainly for my future reference, but thought others might also find this useful.
Joe