How to run Pip commands from CMD

Little side note for anyone new to Python who didn’t figure it out by theirself: this should be automatic when installing Python, but just in case, note that to run Python using the python command in Windows’ CMD you must first add it to the PATH environment variable, as explained here. To execute Pip, first of all make sure you have it … Read more

xcopy returns error “Invalid number of parameters” when exclude parameter is set

XCOPY is an old command harking back to the days of DOS. It looks like the /EXCLUDE option was never updated to support long file names. Ugh 🙁 If you remove the quotes, then the text after the space is interpreted as an additional parameter, and you get the “Invalid number of parameters” error. If … Read more

“if not exist” command in batch file

You have it almost done. The logic is correct, just some little changes. This code checks for the existence of the folder (see the ending backslash, just to differentiate a folder from a file with the same name). If it does not exist then it is created and creation status is checked. If a file … Read more

“if not exist” command in batch file

You have it almost done. The logic is correct, just some little changes. This code checks for the existence of the folder (see the ending backslash, just to differentiate a folder from a file with the same name). If it does not exist then it is created and creation status is checked. If a file … Read more

How to “comment-out” (add comment) in a batch/cmd?

The rem command is indeed for comments. It doesn’t inherently update anyone after running the script. Some script authors might use it that way instead of echo, though, because by default the batch interpreter will print out each command before it’s processed. Since rem commands don’t do anything, it’s safe to print them without side … Read more

How do I kill the process currently using a port on localhost in Windows?

Step 1: Open up cmd.exe (note: you may need to run it as an administrator, but this isn’t always necessary), then run the below command: netstat -ano | findstr :<PORT> (Replace <PORT> with the port number you want, but keep the colon) The area circled in red shows the PID (process identifier). Locate the PID of the process that’s … Read more