Showing posts with label batch. Show all posts
Showing posts with label batch. Show all posts

Command Prompt: Pause with "Press any key to continue"

In a batch file, add pause to display the "Press any key to continue . . ." message.

@echo off
php generate.php
pause

Optionally you can use "@echo off" to hide the commands being sent, so the script wont display stuff like "php generate.php" and "pause".

Multiple Programs with Windows Batch Files

When it comes to starting up my computer for work, theres quite a few applications I need to run.
Rather than having to set up shortcuts for each one, I would rather just click on one shortcut and load them all at once.

Creating a batch file will do the job fine, however there is a small problem.
To demonstrate the problem, see the first attempt most people would make.
%WINDIR%\System32\calc.exe
%WINDIR%\System32\notepad.exe
%WINDIR%\System32\write.exe
This will load up Calculator, Notepad and Wordpad.
However, the interesting quirk is that the batch file will not continue to execute Notepad until Calculator is closed.
Likewise with Wordpad, it will not execute it until Notepad is closed.

To overcome this, we need to change the way that applications are started.
Rather than calling the executables directly, we use "start".
start /d "%WINDIR%" calc.exe
start /d "%WINDIR%" notepad.exe
start /d "%WINDIR%" write.exe
start /d "%PROGRAMFILES%\Adobe\Acrobat" acrobat.exe

This way, you can also add optional arguments to the application.
start /d "C:\Path\To\Your Application" app.exe "D:\input\movie name.avi"

[ Source ]

Batch renaming files on Linux

I had a bunch of PNG files which had both upper-case and lower-case extensions.

Trying to rename them in Windows was painful as I needed to rename it to a temporary extension, commit, then rename back and commit again.

I found a handy script to use in the command line of Linux, and since it supported case-sensitive filenames, all I had to do was rename and commit.
for file in *.PNG ; do svn mv $file `echo $file | sed 's/\(.*\.\)PNG/\1png/'` ; done
Worked like a charm!
 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog