command-line

How do I silently install a 7-zip self-extracting archive to a specific directory?

﹥>﹥吖頭↗ 提交于 2020-01-30 19:37:12
问题 The Ruby Devkit is a 7-zip based self-extracting archive. I would like to invoke it silently without having to install 7-Zip to extract the files to a folder of my choosing, so that I can script the installation. I imagine it to be something like: cmd> DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe /silent /dir="C:\DevKit" But that, of course, doesn't work. What command line flags must I use to silently extract this archive into a folder of my choice? 回答1: try this: C:\> DevKit-tdm-32-4.5.2

Pass git commit message to npm script and append to predefined string

99封情书 提交于 2020-01-30 11:55:29
问题 In an NPM project, I'd like to have a commit for each build version. This will allow me to go back to the current build version, fix a bug, without having to go through all the QA of a new version. We can commit using npm scripts like this (see this answer): package.json "scripts": { "git": "git add . && git commit -m", } Then invoke the script by running: npm run git -- "Message of the commit" I'd like to automate it to run after npm run build. For this purpose we can create a new command.

“python” and “pip” command not found in Command Line [duplicate]

点点圈 提交于 2020-01-30 11:34:06
问题 This question already has answers here : How to add to the PYTHONPATH in Windows, so it finds my modules/packages? (22 answers) Closed 2 years ago . I recently installed Python 3.6 for my Windows 10 (64bit) and I want to use pip, but before to install that, I need to execute the following command using the downloaded get-pip.py program: python get-pip.py Somehow this doesn't work and I get the following message from Command Line: 'python' is not recognized as an internal or external command,

grep out load average from uptime

*爱你&永不变心* 提交于 2020-01-30 07:44:05
问题 what I want to do is take the command uptime, and get the load averages $ uptime 07:01:30 up 20:29, 2 users, load average: 0.32, 0.39, 0.54 I have a feeling this is something I can do with awk, but I am not quite sure how. pls assist. 回答1: You can use a regex with backreferences: i.e. find any sequence of characters (.*) but only at a point directly after average: uptime | grep -oP '(?<=average:).*' 回答2: You can use grep uptime | grep -o 'load.*' Also you can extract the three load average

Windows console width in environment variable

有些话、适合烂在心里 提交于 2020-01-27 08:18:44
问题 How can I get the current width of the windows console in an environment variable within a batch file? 回答1: I like the approach using the built-in mode command in Windows. Try the following batch-file: @echo off for /F "usebackq tokens=2* delims=: " %%W in (`mode con ^| findstr Columns`) do set CONSOLE_WIDTH=%%W echo Console is %CONSOLE_WIDTH% characters wide Note that this will return the size of the console buffer, and not the size of the window (which is scrollable). If you wanted the

Windows console width in environment variable

爱⌒轻易说出口 提交于 2020-01-27 08:17:27
问题 How can I get the current width of the windows console in an environment variable within a batch file? 回答1: I like the approach using the built-in mode command in Windows. Try the following batch-file: @echo off for /F "usebackq tokens=2* delims=: " %%W in (`mode con ^| findstr Columns`) do set CONSOLE_WIDTH=%%W echo Console is %CONSOLE_WIDTH% characters wide Note that this will return the size of the console buffer, and not the size of the window (which is scrollable). If you wanted the

Connect to different port using MySql Command Line Client

[亡魂溺海] 提交于 2020-01-26 04:04:49
问题 By default I am being connected to port 3309.I need to connect to port 3307.How do I do that? 回答1: Use -P parameter, like this: mysql -h 127.0.0.1 -P 3307 -u user_name -p database_name Important: if you connecting to localhost - use -h 127.0.0.1, NOT localhost, because MySQL will connect by file socket, not by TCP 回答2: From command line, assuming you are on the same host, have you tried : mysql --user root --password (mypassword) --host=localhost --port=33061 In server name specify custom

Connect to different port using MySql Command Line Client

元气小坏坏 提交于 2020-01-26 04:03:59
问题 By default I am being connected to port 3309.I need to connect to port 3307.How do I do that? 回答1: Use -P parameter, like this: mysql -h 127.0.0.1 -P 3307 -u user_name -p database_name Important: if you connecting to localhost - use -h 127.0.0.1, NOT localhost, because MySQL will connect by file socket, not by TCP 回答2: From command line, assuming you are on the same host, have you tried : mysql --user root --password (mypassword) --host=localhost --port=33061 In server name specify custom

Results of perforce command to command line variable

筅森魡賤 提交于 2020-01-25 11:10:03
问题 I'm working within a batch file and I have a Perforce command to call in order to gain some user information. The command is: p4 -Ztag -F %clientName% info Now what I need is for the result of this command to be held in either a variable or a file (ideally the former). But for the life of me I can't figure out how to do so, can someone please help me out. I gave the following command a try: p4 -Ztag -F %clientName% info > %HOMEPATH%\clientName.txt But the results were: p4 -Ztag -F info 1>

Ruby - Calling commands and interact with shell in Windows environment

邮差的信 提交于 2020-01-25 10:02:48
问题 I am running an .exe file in the command line from a Ruby script that asks the user for a Yes/No response. I would like to know how the user can interact with it in Windows environment. I have tried all the possible options: system , backticks, %x() , Open3, Open4... and none of them work. Some posts ([1], [2]) resolve the issue using PTY, but as to my knowledge there is no implementation of the PTY module in Windows. Any other idea? 回答1: Seems this is working under Windows too pipe = IO