command-line

Output to command-line if started from command line

你。 提交于 2020-01-22 12:42:45
问题 I'm writing an application that can be started either as a standard WinForms app or in unattended mode from the command-line. The application was built using the VS 2k5 standard WinForms template. When the application is executed from the command-line, I want it to output information that can be captured by the script executing the application. When I do this directly from Console.WriteLine(), the output does not appear, although it can be captured by piping to a file. On the other hand, I

Batch replace text inside text file (Linux/OSX Commandline)

*爱你&永不变心* 提交于 2020-01-22 10:02:13
问题 I have hundreds of files where I need to change a portion of its text. For example, I want to replace every instance of "http://" with "rtmp://" . The files have the .txt extention and are spread across several folders and subfolder. I basically am looking for a way/script that goes trough every single folder/subfolder and every single file and if it finds inside that file the occurrence of "http" to replace it with "rtmp". 回答1: You can do this with a combination of find and sed : find .

How to convert a text file to binary file using linux commands

旧时模样 提交于 2020-01-22 09:29:09
问题 I have hex code of a binary in text (string) format. How do I convert it to a binary file using linux commands like cat and echo ? I know command following command with create a binary test.bin. But what if this hexcode is in another .txt file ? How do I "cat" the content of text file to "echo" and generate a binary file ? # echo -e "\x00\x001" > test.bin 回答1: use xxd -r . it reverts a hexdump to its binary representation. source and source Edit : The -p parameter is also very useful. It

How to activate different anaconda environment from powershell

你。 提交于 2020-01-22 08:54:08
问题 I have two environments in anaconda, namely: root , 2env . When I open anaconda prompt, I can switch from root to 2env by typing: activate 2env . I also have conda in my powershell, but when I open powershell and try to run conda activate 2env it gives the following error: CommandNotFoundError: 'activate' Any suggestions on how to fix this? 回答1: Although Conda previously did not support PowerShell, this is now resolved in Conda 4.6. After adding Anaconda3/Scripts/ to your PATH variable, you

How to enable tab-completion of command line switches in bash?

旧巷老猫 提交于 2020-01-22 07:20:27
问题 With bash , I can complete a command with TAB. Normally, it should also complete the command line switches: e.g. when I typed: java - it should show me the possibilities. It does not. How can I enable this preview? See also Surprise! the shell suggests command line switches 回答1: Take a look at Extended Bash Completion 回答2: Related: Surprise! the shell suggests command line switches In the answers to that question there were several links to documentation. You might find what you look for

Difference between IISRESET and IIS Stop-Start command

感情迁移 提交于 2020-01-22 04:33:31
问题 Is there any difference between commands iisreset and iisreset /stop followed by iisreset /start ? 回答1: Take IISReset as a suite of commands that helps you manage IIS start / stop etc. Which means you need to specify option ( /switch ) what you want to do to carry any operation. Default behavior OR default switch is /restart with iisreset so you do not need to run command twice with /start and /stop . Hope this clarifies your question. Check this MS DOS help picture you will understand. 回答2:

plugins pattern + sub command

时光总嘲笑我的痴心妄想 提交于 2020-01-22 01:57:29
问题 I will do a command line application with plugin capability, each new plugin will be invoked by a sub command from a __main__.py script. I used to use argparse , I wonder if it's possible with argparse to implement sub command + plugin looking like (I found some tool but using deprecated packages) ? myfantasticCLI ├── __main__.py └── plugins ├── create.py ├── notify.py └── test.py I know that I could use argparse for sub command, but don't know how to use it in a dynamic loading way. :/ 回答1:

plugins pattern + sub command

橙三吉。 提交于 2020-01-22 01:56:48
问题 I will do a command line application with plugin capability, each new plugin will be invoked by a sub command from a __main__.py script. I used to use argparse , I wonder if it's possible with argparse to implement sub command + plugin looking like (I found some tool but using deprecated packages) ? myfantasticCLI ├── __main__.py └── plugins ├── create.py ├── notify.py └── test.py I know that I could use argparse for sub command, but don't know how to use it in a dynamic loading way. :/ 回答1:

Substituting shell variables into awk pattern looking scanning through file

…衆ロ難τιáo~ 提交于 2020-01-21 18:55:34
问题 NOTE : I am a noob at bash scripts and the awk command - please excuse any dumb mistakes I make. I am unable to substitute shell variables into my awk pattern. I am trying to scan through a file, find the first occurence of a specific string in the file, and print each line that succeed it in order until it hits an empty string/line. I don't know the string I am searching for in advance, and I would like to substitute in that variable. When I run this with the string directly specified (e.g "

What is the windows equivalent of Linux command wc -l?

人走茶凉 提交于 2020-01-21 15:02:06
问题 I have a piece of code that is meant to send the following to the linux command line: wc -l C:/inputdirectory/P* However, I need to run this script in Windows, and am trying to find the equivalent command. I have tried find /c /v C:/inputdirectory/P* But this throws an error, that /v is not a valid command. Can you please tell me why this isn't working? *note, the command itself doesn't say "inputdirectory", it has the correct directory, it's just too tedious and private to type out 回答1: How