command-prompt
Server is already running in Rails
TL;DR Just Run this command to Kill it sudo kill -9 $(lsof -i :3000 -t) Root Cause: Because PID is locked in a file and web server thinks that if that file exists then it means it is already running. Normally when a web server is closed that file is deleted, but in some cases, … Read more
sh.exe.stackdump when use git stash
I was experiencing this problem for months, I tried numerous Internet solutions (PATH fix, reinstall), today I finally managed to solve: The problem was a conflict with Comodo Internet Security (Comodo Firewall in my case), when I removed it, the error disappeared immediately. I found the solution here: https://github.com/desktop/desktop/issues/4556 And here how to preserve the … Read more
batch file Copy files with certain extensions from multiple directories into one directory
In a batch file solution for /R c:\source %%f in (*.xml) do copy %%f x:\destination\ The code works as such; for each file for in directory c:\source and subdirectories /R that match pattern (\*.xml) put the file name in variable %%f, then for each file do copy file copy %%f to destination x:\\destination\\ Just tested … Read more
How do I minimize the command prompt from my bat file
There is a quite interesting way to execute script minimized by making him restart itself minimised. Here is the code to put in the beginning of your script: if not DEFINED IS_MINIMIZED set IS_MINIMIZED=1 && start “” /min “%~dpnx0” %* && exit … script logic here … exit How it works When the script is … Read more
Run a Command Prompt command from Desktop Shortcut
Create A Shortcut That Opens The Command Prompt & Runs A Command: Yes! You can create a shortcut to cmd.exe with a command specified after it. Alternatively you could create a batch script, if your goal is just to have a clickable way to run commands. Steps: Right click on some empty space in Explorer, … Read more
Command line for looking at specific port
Here is the easy solution of port finding… In cmd: netstat -na | find “8080” In bash: netstat -na | grep “8080” In PowerShell: netstat -na | Select-String “8080”
How do I make a log of all ECHO commands in a BATCH file?
for this purpose I use the following: set LogFile=somepath\logfile.txt set logg=^> _^&type _^&type _^>^>%LogFile% echo this goes to screen AND file! %logg% This is a bit tricky. So let’s disassemble that line to four parts: set logg= ^> _ ^&type _ ^&type _^>^>%LogFile% The Idea is to print the line to a temporary file (named … Read more
How to answer to prompts automatically with python fabric?
Starting from version 1.9, Fabric includes a way of managing this properly. The section about Prompts in the Fabric documentation says: The prompts dictionary allows users to control interactive prompts. If a key in the dictionary is found in a command’s standard output stream, Fabric will automatically answer with the corresponding dictionary value. You should … Read more
remove last STDOUT line in Python
You might be able to do what you want with VT100 control codes. Something like this maybe: CURSOR_UP_ONE = ‘\x1b[1A’ ERASE_LINE = ‘\x1b[2K’ print(CURSOR_UP_ONE + ERASE_LINE)