-1

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.

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!

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

sbtpr
  • 541
  • 5
  • 18
  • Post what you've already tried. Perhaps you should look into [electron](https://electronjs.org/) – peteb Jan 09 '18 at 19:58
  • Look, this is a marginal issue, I won't put serious effort to make a research on this, I have enough problems with the app itself. But it is annoying enough so that I give it a try with this question. I don't want a desktop app, because at times I need the console output for debugging. – sbtpr Jan 09 '18 at 20:02

2 Answers2

0

I made it. It is a Windows trick.

Based on this answer:

How do I minimize the command prompt from my bat file

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

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.

sbtpr
  • 541
  • 5
  • 18
0

There is a workaround, at least in my used case. But this just minimized the node console only. It will still appear in the taskbar.

I just created a shortcut with

  • Target: C:\WINDOWS\system32\cmd.exe /c start /min node < Your Application >
  • Start in: < Path to your application >

"Start in" is not required if you specify the full path to your application

Examples:

  • Target: C:\WINDOWS\system32\cmd.exe /c start /min node "C:\Users\jjyong\Documents\Programming\Node\PriceTracking\app.js"

    Or

  • Target: C:\WINDOWS\system32\cmd.exe /c start /min node app.js

  • Start in: C:\Users\jjyong\Documents\Programming\Node\PriceTracking

Note: I have only tested using NodeJS version 12.13.1 with PuppeteerJS running chromium with "headless: false"

Jun Jie
  • 1
  • 1