have both cmd and bash tricks for you people.
the cd command is limited to the current drive. Type the drive letter and a colon to switch to another drive, note that your current directory is drive specific! Which is sweet btw...
In windows 10, you can now press control v to paste into cmd, although putty doesn't like this. Control c still sends it's char because it kinda has to!
pushd and popd are useful, especially for working with UNC paths.
Unix style paths work on windows, for example "cd /" changes to the root of your current drive, I always find myself using / instead of backslash, which makes some programs have a fit...
if you use the dir command to list a directory and you don't like all the extra output, add a /b switch and it'll list it like ls, just the filenames and foldernames in it.
if you wish to remove a directory, use rmdir, or rd. If the directory is not empty it will yell at you, "rd /s" fixes that. Also del has a /s switch, which does recursive deletion, here's a practical example.
del /s *.sfk
del /s *.sfl
del /s *.reapeaks
you will get spammed with output, you could try using > nul, maybe? But it will delete all those stupid files audio editors generate.
A particular command I use if I wish to run a game server compiled for windows on linux, that doesn't terminate when I kill the ssh session, looks like this. Note that you need no additional packages except of course wine.
nohup wine server.exe &
the nohup makes it not receive a hang up signal, which will make it less likely to die when you close your ssh, and won't make it run in your console. The '&' on the end there is something strange that makes it run completely background, meaning you can log off and it'll keep going! To make it die, use pkill wine, or I believe pkill server.exe also works.
if you're making windows batch files, @echo off is a very common line to use, to make the command shell not log your commands but only the output.
Another command used in batch files is "setlocal enableextensions" which makes all environment variable changes local so you can store temp stuff that stays temp, and enableextensions does something that I don't really know much about.
A nice command in batch files if you wish to prompt the user for some input instead of making them specify it as an argument to the batch file, so they can press enter on it, is the following.
set /p inp="enter some text here"
rem just throw it back at them
That could be used for a youtube-dl batch file... Hehe!
Windows has three different copy commands for different things. Copy, xcopy and robocopy. Use their corresponding /? switches, and make sure you redirect to a file because the output of those commands is several pages long and your cmd will flat wrap.
If you wanna shut down your computer, and be cool and/or quick about it, use
"shutdown.exe /s /t 00 /f"
you could also use /r instead of /s to make it reboot.
If you want to add a filetype, such as .py, .pl etc to your execution path so you can click on them from explorer and they will just run, once you've configured to open them with their interpreter obviously, open an admin command prompt and use this one.
You'll have to log out and back in for that to work.
I'm still struggling with the exact syntax for the ftype and assoc commands, but they're fun to use, because they're a quick and painless way to register a file extension to be opened by a program without the windows explorer dialog crap. I actually used it once to associate all the dependency files for rhythm rage levels with notepad, because you can have more than one extension associated with the same type! You have to use multiple assoc commands though.
Again for batch file people, who don't use it and you want to run a program that does it's own thing from a batch file, use the start command so it doesn't hang up your batch file.
the title command is useful btw, changes the title of your prompt so it can cram it's path up it's binary ass.
if you are doing batch files and you want the user to press a key before something happens, pause. It freezes your batch file until they hit a key, prompting them with "press any key to continue..."
And for people who are programming and want cmd to do something, cmd itself has two switches. /c and /k. /c executes a command and closes, /k executes a command and leaves it open, useful for examining output but unfortunately also reprompting the user with the do stuff prompt... Maybe try either using > to output stuff to a temp file or if it's possible grab it's stdout/stderr directly.
Sorry for the spam, just thought of all that shit on the fly in bursts. Enjoy!
An anomaly in the matrix. An error in existence. A being who cannot get inside the goddamn box! A.K.A. Me.