There are many ways your can simplify your regular day to day activities using windows/dos commands or shell scripts if you are using Linux. Here is the way you can start thinking about how you can do it!
Delete temporary files from your machine
Many times you want to delete the temporary files from your machine. So need to first of all go to the temporary files’ folder – ‘C:\Users\<UserName>\AppData\Local\Temp‘ (or just run –> %temp% –> enter; if you know it 🙂 ), select all files and then delete it.
Well, how about creating a batch script once, and just execute it whenever you want to do so, isn’t it a great idea?
Copy the below commands as a TempDelete.bat file, save it on your desktop (or wherever you you feel life saving it), and just double click on it whenever you want to clear your %temp% folder!
cd %temp% del /s /q . rmdir /s /q .
The first line opens up the DOS command prompt temporary files’ folder, the second command deletes all the files not in use currently and the third command removes all the child folders.
Just FYI, /q disables Yes/No prompting and /s optilon deletes the file(s) from all sub-directories.
Getting latest files from TFS version control system
If you are a developer, multiple people are working within your team and are doing code check-ins extensively, you must have to keep the local version of the code in sync with the version control system, right?
The people doing this regularly would be able to easily co-relate. If you are using Visual Studio, you need to reach to your project subfolder (and to reach at that folder too, you need to do multiple clicks, wait for folder to get updated with the child folders and files) and then right click, ‘get latest files’.
Well, there is a better way. Just create a batch file once, reach to the folder in the command prompt and get latest files using TF.exe command. When you are using Visaul Studio TFS GUI, the same commands are getting executed behind the scenes.
cd C:\path\to\mapped\folder\api "<PathToIde>\TF.exe" get $/project/code/api/Main/ /recursive cd C:\path\to\mapped\folder\web "<PathToIde>\TF.exe" get $/project/code/web/Main/ /recursive
Copy the above commands and save it as a .bat file, update the <PathToIde> depending on the Visual Studio version you have installed and your OS.
For Windows 7-64 bit, Visual Studio version 10, its
%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\Common7\IDE\TF.exe
Find out where TF.exe is located on your machine and update it.
The good thing is, if you are having a conflict between the source control version and the local version, this command also provides you a GUI to solve it!
Isn’t this great?!
Now just call this batch file from your command prompt, and get the latest version of files from all the project in single batch script. You’ll never know how much time and efforts you are saving by doing this unless you do this once or twice.
After all, laziness is a blessing to motivate you for an innovative idea!!!
Do comment below what other things you have simplified after getting motivation from your laziness 🙂