1

I want to detecting if the current running bat script is hidden by the caller, that means (nCmdShow=0) for example.

There is windows API to get this information, GetStartupInfo, but it can not be called by command prompt or VBScript(without third party libraries).

The following script can retrieve the startup information, but the problem is that's only works under WinXp, it's doesn't work under Win7. I am looking for a way can support across winxp - win8. Dim wmiService Set wmiService = GetObject("winmgmts:\\.\root\cimv2") Dim startupInfo Set startupInfo = wmiService.Get("Win32_ProcessStartup")

The following code works fine under xp, but doesn't work under win7, it's show all the startup information.

On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_ProcessStartup",,48)
For Each objItem in colItems
    Wscript.Echo "CreateFlags: " & objItem.CreateFlags
    Wscript.Echo "EnvironmentVariables: " & objItem.EnvironmentVariables
    Wscript.Echo "ErrorMode: " & objItem.ErrorMode
    Wscript.Echo "FillAttribute: " & objItem.FillAttribute
    Wscript.Echo "PriorityClass: " & objItem.PriorityClass
    Wscript.Echo "ShowWindow: " & objItem.ShowWindow
    Wscript.Echo "Title: " & objItem.Title
    Wscript.Echo "WinstationDesktop: " & objItem.WinstationDesktop
    Wscript.Echo "X: " & objItem.X
    Wscript.Echo "XCountChars: " & objItem.XCountChars
    Wscript.Echo "XSize: " & objItem.XSize
    Wscript.Echo "Y: " & objItem.Y
    Wscript.Echo "YCountChars: " & objItem.YCountChars
    Wscript.Echo "YSize: " & objItem.YSize
Next
lygstate
  • 564
  • 6
  • 12

1 Answers1

0

There is a way of calling API calls in VBS or batch.

appactivate between multiple internet explorer instances

Although the sample given doesn't work 7 and later because of a name conflict. Rename sendmail to something else for 7 and later.

If a limited user you need to manually add the registry entries to hkcu\software\classes.

Community
  • 1
  • 1