Jul 202012
 

As simple and straightforward as they may seem, text files still harbor an opportunity for compatibility problems. Different operating systems have traditionally used different ways to indicate line endings (line breaks). Mac OS has traditionally used the Carriage Return character (ASCII chcracter 13, aka CR or ^M) to indicate line breaks; unix has traditionally used the Line Feed character (ASCII 10, aka LF or ^J). Since Mac OS X derives from both heritages, it winds up using a mix of the two in various contexts. But most command line utilites only understand (and produce) files with unix-style breaks.Just to make things even more fun, there’s actually a third variant: MS-DOS its successors use a carriage return followed by a line feed to indicate a line break. Few Macintosh programs will generate such files, but if you need to deal with a file that came from a PC, you’ll probably want to convert it to a more native format on the Mac.

Fortunately, it’s fairly easy to convert the formats back and forth on the command line. Here are some examples of how to transform files back and forth:

tr '\r' '\n' <macfile.txt >unixfile.txt
convert the Mac-format file macfile.txt to unix format, and save
the result as unixfile.txt. tr is a program that does character
substitution, and in this case it's simply being used to replace
CR (written \r on the command line) with LF (written \n)
throughout the file.

tr '\r' '\n' <macfile.txt | grep fnord
convert the Mac-format file macfile.txt to unix format, then use
grep to search the file for the word "fnord". (Note: grep doesn't
understand Mac-style line breaks.)

tr '\n' '\r' <unixfile.txt >macfile.txt
convert the unix-format file unixfile.txt to Mac format, and save
the result as macfile.txt.

perl -p -e 's/\r/\n/g' macfile.txt >unixfile.txt
convert the Mac-format file macfile.txt to unix format, and save
the result as unixfile.txt. This is functionally identical to the
first example, but since perl is actually a very general
programming language, it can also do some other useful things...
BTW, he -e means the program will be the next thing on the command
line ('s/\r/\n/g' - perlese for replace all \r's with \n's), and
the -p means do this for each line of the file.

perl -pi -e 's/\r/\n/g' textfile.txt
convert the file textfile.txt from Mac-style (CR) line breaks to
unix-style (LF), and replace the original file with the converted
version (that's what the -i means).

perl -pi -e 's/\r\n?/\n/g' textfile.txt
convert the file textfile.txt from Mac-style (CR) or PC-style
(CRLF) line breaks to unix-style (LF), and replace the original
file.

perl -pi -e 's/\r\n?/\n/g' *.txt
convert all text files (or rather, files with .txt extensions)
in the current directory to unix-style breaks. Note that any that
were already in unix format will not be changed.

perl -pi -e 's/\n/\r/g' textfile.txt
convert the file textfile.txt from unix-style (LF) line breaks to
Mac-style (CR), and replace the original file. Source

Source
Jul 212011
 

The following is the command line for MSCDEX.EXE:

MSCDEX.EXE: /D:x /M:n /E /V /L:x /S /K

The following
table defines the MSCDEX.EXE command-line switches:

Switch                  Definition

/D:<device name>        - Allows you to specify a name for the device
                          driver. This name must be identical to the
                          device name used in the CONFIG.SYS file.

/M:<n>                  - Specifies the number of sector buffers used
                          to cache the path table of a CD-ROM disk.
                          Typically, each drive should have a minimum
                          of four to five buffers. The larger this
                          number is, the less your computer will have
                          to read directly from the CD-ROM drive.

/E                      - Tells MSCDEX.EXE to use expanded memory if
                          your system is using expanded memory.

/V                      - Displays information on memory usage
                          when you boot your PC.

/L:<drive letter>       - Allows you to specify the letter you want
                          to assign to the first CD-ROM drive.

/S                      - Allows the CD-ROM to be shared on MS-NET
                          based systems.

/K                      - Tells MSCDEX.EXE to use any KANJI (Japanese)
                          file structures, if present, rather than the
                          default of alphanumeric file structures.
Aug 202010
 

Robert.Hollands.Multicast.Session.Files: Extract these two files and copy them to a DOS formatted floppy disk or bootable CDROM with GHOST.exe. Then boot your target computer with the floppy disk or CDROM to connect to your multicast session.

 

Here are some Ghost command line tips and examples from Symantec’s website:

Switches: Cloning

Situation: This document describes Ghost’s -CLONE switch and the command-line parameters that are used as arguments for that switch.

Solution: Ghost uses the -CLONE switch to specify the cloning operation that you want Ghost to perform.

Note that many additional switches can also be used while cloning. For a description of other Ghost switches, see the Ghost Implementation Guide that accompanied your copy of Ghost, or read the document Switches: Alphabetical list of switches.

-CLONE

The full syntax for this switch is:

-clone, MODE={copy|load|dump|pcopy|pload|pdump},
SRC={drive|file|drive:partition|@MCsessionname|@MTx},
DST={drive|file|drive:partition|@MCsessionname|@MTx},
SZE{F|L|n={nnnnM|nnP|F|V} }

Each -CLONE command can be used for only one imaging process at a time. For instance, you can use a single -CLONE command to restore one partition from an image file that has five partitions, but you cannot use a single -CLONE command to restore two partitions from an image file that has five partitions. To perform multiple imaging operations, use successive -CLONE commands on the same command line with the -BATCH command, or create a batch file that has multiple Ghost.exe or Ghostpe.exe command lines. For an example of the -BATCH command, see Example 14 in this document.

——————————————————————————–
Note: For information on the clone switches for Norton Ghost 2003, refer to page 166 of the Norton Ghost 2003 User’s Guide located on the CD or on your hard drive. The Norton Ghost 2003 User’s Guide is automatically installed on your hard drive during the installation. The default location and file name for the Norton Ghost 2003 User’s Guide is \Program Files\Symantec\Norton Ghost 2003\Ghost_Guide.pdf. Adobe Acrobat Reader must be installed to view the User’s Guide. A copy of Adobe Acrobat Reader is included on the Norton Ghost 2003 CD or it can be downloaded from www.adobe.com.
——————————————————————————–

MODE=COPY
Used to copy the contents of one hard drive to another.

,SRC=drive number Number of the source drive. For example, 1 for the first drive.
,DST=drive number Number of the destination drive.
For an internal drive: The drive number of the destination drive in the computer. For example, use 2 for the second internal drive.
For an LPT connection: The drive number of the drive in the slave computer. For example, use 1 for the first drive on the slave computer.
For a NetBIOS connection: The drive number of the drive in the slave computer. For example, use 1 for the first drive on the slave computer.
,SZE Set the size of the destination partitions. See explanation of SZE switch below.

MODE=LOAD
Used to copy the contents of an image file to a disk. This will copy all the partitions in the image file.

,SRC=<path and filename> or tape device For an internal drive: The path and filename of the image on the local drive. For example: C:\IMAGE.GHO.
For a tape drive: Use @MTx where x is the number of the SCSI device starting at 0 and incrementing for each device present.
For an LPT connection: The image file on the slave computer. For example: C:\IMAGE.GHO. Must also use -LPM switch.
For a NetBIOS connection: The image file on the slave computer. For example: C:\IMAGE.GHO. Must also use -NBM switch.
For Multicasting: The multicast session name using @Mcsessionname where sessionname is the name of the multicast session. For example, @MCsession1.
,DST=drive number The number of the destination drive. This refers to the internal drive on the computer. For example, use 2 for drive two.
,SZE Set the size of the destination partitions. See explanation of SZE switch below.

MODE=DUMP
Used to create an image file of a disk. This copies all of the partitions to an image file

,SRC=drive number Number of the source drive. For example, use 1 for drive one.
,DST=<path and filename> or tape device  For an internal drive: The path and filename of the image on the local drive. For example: C:\IMAGE.GHO.
For a tape drive: Use @MTx where x is the number of the SCSI device starting at 0 and incrementing for each device present.
For an LPT connection: The image file on the slave computer. For example: C:\IMAGE.GHO. Must also use -LPM switch.
For a NetBIOS connection: The image file on the slave computer. For example: C:\IMAGE.GHO. Must also use -NBM switch.
For Multicasting: The multicast session name using @Mcsessionname where sessionname is the name of the multicast session. For example, @MCsession1.
For a CD-R or CD-RW drive: Use @CDx where x is the number of the CD/R or CD/RW device on the IDE or SCSI chain.

MODE=PCOPY
Used to duplicate a partition to another partition.

,SRC=source partition The Drive number:Partition number of source drive. For example: 1:2 refers to the second partition on the first drive.
,DST=destination partition The Drive number:Partition number of the destination drive.
For an internal drive: The drive number and partition number of the internal drive you are writing to. For example, use 2:1 to specify the first partition on the second drive.
For an LPT connection: The drive number and partition number of the drive on the slave computer. Number the drives as if they were connected locally. For example, use 1:3 to specify the third partition on the first drive on the slave computer. Must also use the -LPM switch.
For a NetBIOS connection: The drive number and partition number of the drive on the slave computer. Number the drives as if they were connected locally. For example, use 1:3 to specify the third partition on the first drive on the slave computer. Must also use -NBM switch.
For Multicasting: The multicast session name using @Mcsessionname where sessionname is the name of the multicast session. For example, @MCsession1.

MODE=PLOAD or MODE=PRESTORE
Used to copy a partition from an image file to a local drive.

——————————————————————————–
Note: The pload switch is replaced by the prestore switch in Symantec Ghost 8.x and higher. The pload switch is still fully functional and is interchangeable with prestore.
——————————————————————————–

,SRC=<path and filename>:<partition number> or tape device
For an internal drive: The path and file name of the image on the local drive followed by the partition number in the image. For example: C:\IMAGE.GHO:2
For a tape drive: @MTx where x is the number of the SCSI device starting at 0 and incrementing for each device present.
For an LPT connection: The image file on the slave computer. For example: C:\IMAGE.GHO. Must also use -LPM switch.
For a NetBIOS connection: The image file on the slave computer. For example: C:\IMAGE.GHO. Must also use -NBM switch.
For Multicasting: The multicast session name using @Mcsessionname where sessionname is the name of the multicast session. For example, @MCsession1.

NOTE: When the location of the image file is not a tape device, the SRC parameter requires the partition number even when the source image file has only one partition. That is, when the source image file contains more than one partition, use the partition number to specify which partition you want to write to the destination partition. When the source image contains only one partition, use the numeral 1.

All disk images contain at least one partition. For instance, when a computer has two physical hard drives, one labeled C and the other labeled D and E, the first drive is one partition and the second drive has two partitions. Similarly, a disk image of the first hard drive, C, contains one partition.

For example, when a disk image file contains only one partition and you want to write the disk image from a CD-ROM to the first partition of a two partition disk, use the following command line:

ghost.exe -clone,mode=pload,src=D:GHOSTIMAGE.GHO:1,dst=1:2
,DST=<drive number>:<partition number> The Drive number:Partition number of destination drive. For example: 1:2 refers to the second partition on the first drive.

MODE=PDUMP
Used to create an image file of a partition.

,SRC=source partition The Drive number:Partition number of source drive. For example: 1:2 refers to the second partition on the first drive.
,DST=<path and filename> or tape device  For an internal drive: The path and filename of the image on the local drive. For example: C:\IMAGE.GHO.
For a tape drive: Use @MTx where x is the number of the SCSI device starting at 0 and incrementing for each device present.
For an LPT connection: The image file on the slave computer. For example: C:\IMAGE.GHO. Must also use -LPM switch.
For a NetBIOS connection: The image file on the slave computer. For example: C:\IMAGE.GHO. Must also use -NBM switch.
For Multicasting: The multicast session name using @Mcsessionname where sessionname is the name of the multicast session. For example, @MCsession1.
For a CD/R or CD/RW drive: Use @CDx where x is the number of the CD/R or CD/RW device on the IDE or SCSI chain.

SZE switch
Used to set the size of the destination partitions for a disk load or disk copy operation. This switch is only effective with the LOAD and COPY modes. The SZE switch can be used more than once in the same command.

SZEE The size of all partitions remains fixed. That is, the size of the destination partition will not be different from the source drive.
SZEF Resizes the first partition to maximum size allowed based on file system type.
SZEL Resizes the last partition to maximum size allowed based on file system type. If additional space remains, other partition sizes will be increased.
SZEn=xxxxM Indicates that the nth destination partition is to have a size of xxxx MB. For example, SZE2=800M indicates that the second partition should be 800 MB.
SZEn=mmP Indicates that the nth destination partition is to have a size of mm percent of the target disk. For example, SZE2=40P indicates that the second partition is to be 40% of the total disk space on the target drive.
SZEn=F Indicates that the nth destination partition is to remain fixed in size. For example, SZE3=F indicates that the third partition size is unchanged on the target drive.
SZEn=V Indicates that the nth partition will be resized according to the following rules:
Rule 1: If the destination disk is larger than the original source disk, then the partitions will be expanded to have the maximum amount of space subject to the free space available and the partition type. For instance, FAT16 partitions will have a maximum size of 2048 MB
Rule 2: If the destination disk is smaller than the original source disk, (but still large enough to accommodate the data from the source disk), the free space left over after the data space has been satisfied will be distributed between the destination partitions in proportion to the data usage in the source partitions.

Examples of the CLONE switch

Example 1
Copy drive one to drive two on a computer without the final prompt:

ghost.exe -clone,mode=copy,src=1,dst=2 -sure

Example 2
Connect through NetBIOS to another computer that is running Ghost in slave mode, and dump a disk image of the second local drive to the remote file c:\drive2.gho:

ghost.exe -clone,mode=dump,src=2,dst=C:\drive2.gho -nbm

Note that Ghost at the slave computer can be started with ghost -nbs.

Example 3
Copy the second partition on drive one to the first partition on drive two on the same computer without the final prompt:

ghost.exe -clone,mode=pcopy,src=1:2,dst=2:1 -sure

Example 4
Load the disk image file savedsk.gho on the server drive mapped locally to drive E onto drive 1 of the local computer. Do not prompt if OK to proceed:

ghost.exe -clone,mode=load,src=E:\savedsk.gho,dst=1 -sure

This example is typical what would be in a batch file that automates workstation installations from a network server.

Example 5
Dump the second partition of drive one to an image file on the G: drive:

ghost.exe -clone,mode=pdump,src=1:2,dst=g:\part2.gho

Example 6
Load partition 2 from a two-partition image file on a mapped drive G: onto the second partition of the local disk:

ghost -clone,mode=pload,src=g:\part2.gho:2,dst=1:2

Example 7
Load drive 2 from an image file, and resize the destination partitions into a 60:40 allocation:

ghost.exe -clone,mode=load,src=g:\2prtdisk.gho,dst=2,sze1=60P,sze2=40P

Example 8
Clone a three partition disk and keep the first partition on the destination drive the same size as on the source disk, but divide up the remaining space between the other partitions leaving no unallocated space:

ghost.exe -clone,mode=copy,src=1,dst=2,sze1=F,sze2=V,sze3=V

Example 9
Load drive one from an image file and resize the first partition to 450 MB, the second to 1599 MB and the third to 2047 MB:

ghost.exe -clone,mode=load,src=g:\3prtdisk.gho,dst=1,sze1=450M,sze2=1599M,sze3=2047M

Example 10
Load a disk from an image file and resize the last partition to its capacity. The first partition utilizes the remaining space:

ghost.exe -clone,mode=load,src=g:\2prtdisk.gho,dst=1,szeL

Example 11
Load drive one from an image file being sent from the multicast server with the session name SESSIONNAME without final prompt:

ghost.exe -clone,src=@mcSESSIONNAME,dst=1 -sure

Example 12
Create an image file of drive one to an image file being created by the multicast server with the session name SESSIONNAME without final prompt:

ghost.exe -clone,src=1,dst=@mcSESSIONNAME -sure

Example 13
Create an image file of drive two’s partitions to an image file being created by the multicast server with the session name SESSIONNAME:

ghost.exe -clone,src=2,dst=@mcSESSIONNAME

Example 14
Write an image that has three partitions to drive one. Use an image file that is sent by the Multicast Server or GhostCast Server using the session name SESSIONNAME. Also resize the first partition to 450 MB, the second partition to 1599 MB and the third partition to 2047 MB.

Because this task requires one imaging operation for each partition that you will resize, the task requires that you use a batch file. Using a batch file with error checking prevents the need for user intervention if a problem occurs.

In the following batch file, the first line executes the -CLONE command three times. The first instance uses the word -CLONE, and the other two instances (which are ,sze1=450M and ,sze3=2047M), use the comma to instruct Ghost to use default commands.

The following batch file is incomplete and is intended only as an example of typical commands that a batch file for Ghost might use.

ghost.exe -clone,src=@mcSESSIONNAME,dst=1,sze1=450M,sze2=1599M,sze3=2047M -batch
IF ERRORLEVEL 1 GOTO PROBLEM
ECHO Ghost exited with value of 0 which indicates success.
REM **Add any extra commands that are required here if Ghost succeeds**
GOTO FINISH

:PROBLEM
ECHO GHOST returned with an Error value of 1 or greater.
ECHO Ghosting was not completed successfully
REM **Add any extra commands that are required here if Ghost fails**

:FINISH
ECHO Batch File Finished.

Example 15
In this example, under Symantec Ghost 8.0, there is one hard drive with two partitions. One or both partitions could be an NTFS partition. The following command writes the image of the first partition to the second partition under the image.gho file name.

ghost.exe -clone,mode=pdump,src=1:1,dst=1:2\image.gho

Jan 052010
 

To capture a Networked Printer to an LPT Port on W2K or XP, do the following:

1. Share your local Printer (it can be a USB printer)..
then open a Command Prompt Window and type:

NET USE LPT1: \\computerName\PrinterSharedName

2. Exit the Command Prompt window…

3. Open your other application (in my case, it was a DOS app)
Now print to LPT1.