generated from cotes2020/chirpy-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6237da6
commit fb18a5f
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
layout: post | ||
title: "cmd命令bat脚本隐藏执行窗口" | ||
date: 2023-12-16 17:29:20 +0800 | ||
categories: | ||
- 命令脚本 | ||
tags: | ||
- 命令脚本 | ||
--- | ||
|
||
|
||
家里一直都有远程开3389的需要,一直使用的是frp. | ||
|
||
最近发现总是经常掉线。也不清楚原因,后调查出来原来是由于 | ||
我命令行窗口一般启动的比较多,有时候就会去点一下(选择复制内容),如下: | ||
<img width="847" alt="image" src="https://github.com/MisterChangRay/misterchangray.github.io/assets/16421384/cc28d88e-882f-4c62-b2ca-07b5d145442e"> | ||
|
||
|
||
有时候就会点错到frp的窗口。在windows命令行中执行此操作时,运行的应用将会被挂起。所以通讯就被切断了。 | ||
|
||
后来就想隐藏命令执行窗口,这样就可以避免这些问题了。 | ||
|
||
网上搜索了一圈,bat本身执行是隐藏不了的。只能靠vbs脚本来启动一个隐藏窗口执行bat脚本,这样就可以了。 | ||
|
||
脚本如下: | ||
```bat | ||
mshta vbscript:createobject("wscript.shell").run("cmd /c 这里替换为待执行的bat脚本",0)(window.close)&&exit | ||
``` | ||
注意上面本身就是一个bat脚本,你可以理解为一个启动bat脚本,此时启动的命令行窗口就隐藏了。 |