Home All Groups Group Topic Archive Search About

run a script that cant be closed



Author
11 Aug 2005 7:41 PM
Fabrussio
Is it possible to run a .bat script (from the machines local c:\ drive) that
users can not close?
Or is hidden?

I use the 'start /min' command but students tend to close the window?

thanks

Author
12 Aug 2005 1:21 AM
Marty List
"Fabrussio" <Fabrus***@discussions.microsoft.com> wrote in message
news:2F5EC803-9C8A-4497-8E1C-BE1025611123@microsoft.com...
> Is it possible to run a .bat script (from the machines local c:\ drive)
> that
> users can not close?
> Or is hidden?
>
> I use the 'start /min' command but students tend to close the window?
>
> thanks


Try my freeware tool ShellExecute.exe, it will allow you to launch a hidden
window.

ShellExecute.exe /f:C:\MyFolder\MyBatch.cmd /r:hidden

http://www.optimumx.com/download/
Author
12 Aug 2005 2:59 PM
Torgeir Bakken (MVP)
Fabrussio wrote:

> Is it possible to run a .bat script (from the machines local c:\ drive) that
> users can not close?
> Or is hidden?
>
> I use the 'start /min' command but students tend to close the window?
>
> thanks
Hi,

You can use a VBScript (.vbs) to launch a hidden batch file:


LaunchHiddenBatch.vbs

'--------------------8<----------------------
sTitle = "Batch launch"

Set oArgs = WScript.Arguments
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")

If oArgs.Count <> 1 Then
   MsgBox "Error: You need to supply a file path " _
        & "as input parameter!", vbCritical + vbSystemModal, sTitle
   Wscript.Quit 1
End If

sFilePath = oArgs(0)

If Not oFSO.FileExists(sFilePath) Then
   MsgBox "Error: Batch file not found", vbCritical + vbSystemModal, sTitle
   Wscript.Quit 1
End If

' add quotes around the path in case of spaces
oShell.Run """" & sFilePath & """", 0, False

'--------------------8<----------------------




--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

AddThis Social Bookmark Button