在最小化的控制台窗口(Windows 10)中启动Node.js本身时,是否可以使Node.js opn用最大化的窗口打开浏览器? [英] Can I make Node.js opn open the browser with maximized window when Node.js itself is started in a minimized console window ( Windows 10 )?

查看:251
本文介绍了在最小化的控制台窗口(Windows 10)中启动Node.js本身时,是否可以使Node.js opn用最大化的窗口打开浏览器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是,似乎在Windows 10上,在最小化窗口中打开控制台应用程序的桌面链接(.lnk)使得由该控制台应用程序打开的所有窗口也被最小化了.

My problem is that it seems that on Windows 10 a desktop link (.lnk) that opens a console application in a minimized window makes all windows opened by this console application to be also minimized.

我想在最小化的控制台窗口中启动Node.js,但同时使Node.js opn在最大化的窗口中打开浏览器(这很有意义,因为我对控制台不感兴趣输出,而不是我希望在浏览器窗口中输出).

I would like to start Node.js in a minimized console window, but at the same time make Node.js opn open the browser in a maximized window ( this makes sense, since I'm not interested in the console output, rather I want the output in the browser window ).

opn("http://localhost:9000") // but hey, in maximized window!

我可以通过Node.js或通过某些Windows操作来实现这一目标吗?

Is there any way I can achieve this either by Node.js or by some Windows manipulation?

推荐答案

我做到了.这是Windows的把戏.

I made it. It is a Windows trick.

基于此答案:

如何最小化命令提示符从我的蝙蝠文件中

if not DEFINED IS_MINIMIZED set IS_MINIMIZED=1 && start "" /min "%~dpnx0" %* && exit
... script logic here ...
exit

这是脚本在最小化窗口中运行的一种技巧.但是以某种方式继承自.lnk的属性仍保持最大化,因此,在自最小窗口中运行的脚本打开的浏览器窗口将打开浏览器最大化.

This a trick for a script to run itself in a minimized window. But somehow the property inherited from the .lnk remains maximized, so the browser window opened by the script running in its self minimized window opens the browser maximized.

这篇关于在最小化的控制台窗口(Windows 10)中启动Node.js本身时,是否可以使Node.js opn用最大化的窗口打开浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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