Just a friendly warning. If you try to store copy of standard Apache HTTP Server web root, git repository, some Linux directories, etc in the Google Drive, then do not be surprised when Google silently corrupts the filenames by renaming dot (.) to underscore (_). For me this is happening to nix hidden files (begins with a dot), but some of colleagues remember to happen to regular PDFs as well.
Solution. Upload only archived files to the Google Drive. And preferably encrypted (just in case).
Batch scripts is still relevant in 2014. Batch programming is repeatedly used in Windows server and workstation administration to make recurrent tasks easier and more efficient.
In the MS-DOS, Windows 95 and Windows 98, and nowadays in the DOSBox the most popular batch file is autoexec.bat. This file was appropriately named after AUTOmatic EXECution. Commands that are to be executed when DOS starts are placed in this special file particularly on systems that utilize the PROMPT and PATH commands. When pure DOS was the prevalent operating system this was important, however, on our newer Windows guided machines, this is really not of concern. The PATH environment variable can be modified from the System properties – Environment variables.
For creating and editing a batch file, I recommend to use Windows Notepad, or more advanced editor with syntax highlighting support, such as free and open source editor – Notepad++. You will save your batch files with a .bat or .cmd file extension. Some of the file naming conventions (requirements) for batch files include: not recommended to use any internal DOS commands for file names for example, ECHO.bat, ERASE.bat, PAUSE.bat, etc., and SPACES, and device names such as LPT, COM1, COM2, NUL, etc., and it is NOT OKAY to use the following special characters in a filename:
\ – Backslash
/ – Slash
: – Colon
? – Question mark
* – Asterisk
” – Quotes
< - Less than sign
> – Greater than sign
| – Pipe
The period must be used as the separator between the file name and the file extension. The colon is specifically used after a letter to identify a particular disk drive. The asterisk and question mark are special wild card characters. Be careful when using these two characters in your script as they can act on multiple files / folders, and with not planed carefully, do some very unpredictable things. The greater than sign, the less than sign and the pipe are special DOS commands to be discussed in the next articles. They are also illegal file names. When naming a DOS file you have even more restrictions.
It should also be noted that good recommended practice for batch file names is to not save them as the same name as another executable file with a different extension. If you already have a file named email.exe do not try to save the batch file as email.bat.
The format for batch files is a series of DOS commands on separate lines. Example: First Command
And so on...
Four types of commands are acceptable for a batch file. These are:
.exe program names
.com program names
.bat / .cmd file names
As with any DOS procedure you can stop a batch program from executing by pressing CTRL+C or CTRL+Break key combination on the keyboard. DOS will ask if you wish to Terminate batch job (Y/N)?. Type N to skip the command you broke out of and proceed to the next command in the batch file. Press Y to abort execution of the batch file and return to the command prompt. Pressing ^Break will produce the same results as ^C (except some commands, like PING).
The last command that we will go over in this section is the VER command. VER stands for VERsion. Enter this into the command prompt and you will be presented with the current version of your DOS program / Operating System. C:\>ver
This article is from our Febooti archive, it was relevant then, and I think that it is still relevant today (a few details changed).
Update Oct 6, 2014: added link to the next article.
First reaction – PHP must be mishandling binary data. Quick search – fread is Binary-safe file read… second thought – PHP ord is converting using Windows code page… no bin2hex is giving the same result.
Second reaction – if two programs show this file differently, and as an example I was using .exe file, this must be some virus or worm, that has installed some poorly coded rootkit.
Today, with fresh view on this strange behavior, I started to get picture from memory. PHP is 32-bit program, FAR that I am using is 64-bit. Raymond Chen or someone else from Microsoft has written, that Windows does not allow 32-bit programs access 64-bit dlls, so that must be it.
The WOW64 subsystem isolates 32-bit binaries from 64-bit binaries by redirecting registry calls and some file system calls. The WOW64 subsystem isolates the binaries to prevent a 32-bit binary from accidentally accessing data from a 64-bit binary. For example, a 32-bit binary that runs a .dll file from the %systemroot%\System32 folder might accidentally try to access a 64-bit .dll file that is not compatible with the 32-bit binary. To prevent this, the WOW64 subsystem redirects the access from the %systemroot%\System32 folder to the %systemroot%\SysWOW64 folder. This redirection prevents compatibility errors because it requires the .dll file to be specifically designed to work with 32-bit programs.
My test file path was: C:\Windows\System32\Notepad.exe and 32-bit application accessed redirected version – C:\Windows\SysWOW64\notepad.exe. This is by design in 64-bit world.