我可以运行带有隐藏cmd窗口的Windows批处理文件,但可以查看由该批处理启动的程序吗? [英] Can I run a windows batch file with hidden cmd window but see the programs started by the batch?

查看:48
本文介绍了我可以运行带有隐藏cmd窗口的Windows批处理文件,但可以查看由该批处理启动的程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以隐藏方式启动批处理文件.此讨论通过使用 CreateProcess API函数很好地描述了它是如何完成的.使用这种方法,启动的批处理脚本不可见.

I want to start a batch file in a hidden way. This discussion describes very well how it can be done: by using the CreateProcess API function. Using this method my started batch script is not visible.

问题在于,批处理内部调用的程序(exes)也被隐藏了!

The problem is though that the programs (exes) called inside of the batch are hidden, too!

我的目标是隐藏已启动的批处理窗口,但显示批处理内部调用的应用程序窗口.

My goal is to hide the started batch windows but show the windows of the applications called inside the batch.

有可能吗?如果是这样,怎么办?我可以使用 CreateProcess 函数还是需要另一个函数?

Is it possible? If so, how? Can I use the CreateProcess function for it or do I need another one?

推荐答案

这应该可以解决问题,在批处理文件中使用此代码来启动EXE.

This should do the trick, use this code in your batch file to start your EXEs.

 @echo off
 title GEO-START v2

 REM  #############################################################
 REM ## GEO-START ## starts any file any location with variables. ##
 REM  #############################################################
 REM ##
 REM "start-and-wait-yes-no" variable, Y is yes, N is no. 
 REM ##
 REM "var" variable, "/silent" or "/y". ## The /y variable is grait for "ms self extracting cabinet files" CAB.exe.
 REM ##
 REM "silent" variable, 0 will set the "var" variable to true and trys to run hidden.
 REM "silent" variable, 1 will set the "var" variable to false.
 REM ##
 REM "GEO-START" variable, the name and location of the file you want to start.
 REM ################################################
 set Y=true
 set N=Wscript.Quit
 REM ##############




 REM #####################
 REM ## variables to set ##

 set start-and-wait-yes-no=%Y%
 set var=/silent
 set silent=1
 set GEO-START=Winamp3 v9.1.exe

 echo Set WshShell = WScript.CreateObject("WScript.Shell") > GEO-START.vbs && echo WSHShell.Run chr(34) + "%GEO-START%" + chr(34) + " %var%",%silent%,%start-and-wait-yes-no% >> GEO-START.vbs && cscript GEO-START.vbs && del GEO-START.vbs
 Exit

这篇关于我可以运行带有隐藏cmd窗口的Windows批处理文件,但可以查看由该批处理启动的程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆