I want to start a file at the command prompt. Who knows how to specify the window position?
Cygwin seems to be able to specify it in the form of [file name -p ... ...], but I did not know what to do with cmd.

  • Answer # 1

    Is the program a Windows application or a console application?
    If it is a Windows application, you can specify STARTUPINFO when starting with the CreateProcess function, but I think there is no way to specify the location on the command line.
    That's possible if you prepare such a program. However, there is a possibility that the program ignores the specified position.
    Similarly for console applications, you can specify STARTUPINFO of the CreateProcess function, but you can also create a shortcut.

  • Answer # 2

    It's not exactly information, but for reference

    Use tools
    UWSC by Umiumi
    nircmd by nirsoft [2]

    Use API [3] [5]

    VB Script [6]

    Reference information
    [1] Specify bat window size-Google Search
    [2] [Batch-file] How can a batch file run the program and set the window position and size? cmd windows-explorer | CODE Q&A [Japanese]
    [3] [266_Start the app by specifying the position and size]-Mr.XRAY
    * This page itself is for Delphi. It can be used from C # in the way [7].


    The first two samples use the CreateProcess function and
      ShellExecuteEx function is used.
      The third method is to use the WH_CBT hook.

    [4] powershell window size specification-Google Search
    [5] Specify window position and size in PowerShell
    [6] I want to specify the launch location of the app without using the tool-Microsoft Community
    * Windows 10&VB Script method

    [7] [If you read it, you'll feel like you've lost it.] Create a file that can directly execute C # code by itself-ClockAhead Development Blog
    * Use csc.exe