Copyright: Copyright © 2000 PowerQuest Corporation. All rights reserved.
Citation: Copyright © 2000 PowerQuest Corporation. All rights reserved.


About ScriptBuilder

Welcome to ScriptBuilder. PartitionMagic includes the ability to make any changes to the partitions on a computer by running a script that you create with ScriptBuilder. The script is an ASCII file with text statements that define the operations to take place.

To play the script from ScriptBuilder, you click Script [image] Play or Save and Play. If the program encounters an error, the script will end immediately and the error is displayed in the message pane.

Each operation in the script run on the partition that was last specified. This means that you must specify a partition before any operation.

ScriptBuilder is only available in PartitionMagic Pro.

 To create a new script

 To save a script

 To open a script for editing

 To test the syntax in a script

 To play a script

 To close ScriptBuilder


Script Suggestions and Notes

Although it is not necessary, we recommend that you check each of the partitions that will be modified at the beginning of the script. Because a script file will terminate when an error occurs, checking each of the partitions first will keep the script from making any changes before it finds errors.

Partitions must start on cylinder boundaries. For example, if you specify 10 MB, the real value could be 10.2 MB. The difference between the specified and actual values will vary depending on the geometry of the disk.

When you specify an amount for one of the script options, the program will allow a margin of error of 1 cylinder above or below that amount (or a range of 2 cylinders centered on the amount specified). For example, if 10 MB were specified for a resize and a cylinder was .5 MB, the operation would complete successfully if it could resize the partition to at least 9.5 MB. The actual range would be 9.5 to 10.5 MB. If it cannot resize the partition within this range, it will return an error.

Under normal operation, if the script determines that it will not be able to reboot the machine after making the changes you specified in the script, the script will terminate with an error. This condition will occur under OS/2 if the DOS.SYS file is not in the CONFIG.SYS (for example, when you boot from the utility disks). You should include ALLOW MANUAL REBOOT as the first statement in the script if it is not a problem performing a manual reboot from the keyboard. All commands must be contained within one line; they cannot start on one line and finish on the next. The maximum length of a script line is 180 characters. Also, each script command must be on a separate line.

Use caution when you select a partition or unallocated space by its number. Numbers can change throughout a script. For example, If you select unallocated 1 and create a new partition filling the entire space, the next unallocated space (if any) becomes unallocated 1. Also, if the newly created partition was between partitions 1 and 2, then the new partition becomes partition 2, and the next partition becomes partition 3.

Using the Select Partition Next and Select Partition Previous commands are usually preferred to selecting partitions or unallocated space by number. With most operations, the partition selected when an operation is complete will be the partition operated on. For example, Resize and Move will always leave the partition operated on as the selected partition after the operation. With the Create option, the partition created will be selected after the commands, whether it is at the beginning or the end of the unallocated space it was created in.


The ScriptBuilder Window

This is the main window in ScriptBuilder. Click an area on the image below to read a description about it.


Menu bar

This is the menu bar. Use it to select options and features (such as commands and parameters) to build your script.


About New

Use New to open a blank window in ScriptBuilder to create a new script file.

Several special characters are used in this online Help when describing the syntax of script file statements.

Character	Denotes
[ ]	An optional parameter.
{ }	A required parameter.
|	A choice among two or more options.
//	Comment (in the C++ form). Comments can be either a full line or after a valid statement.
Script file statements are not case-sensitive. Before you create an operation, you must first select the partition that you want the script to affect.

Instead of creating a script by selecting items from the Insert menu in ScriptBuilder, you can also "record" a script while you use PartitionMagic.

 To create a new script file

 To record a new script


To create a new script file
To create a new script file,

1	From PartitionMagic, click Tools [image] Scripting [image] ScriptBuilder.

2	From ScriptBuilder, click File [image] New.

3	Click Insert, then select a command, query, or statement.

4	In the script edit pane, specify the options you want.

5	Repeat steps 3 and 4 until you are finished creating the script.

6	To save your script file, click File [image] Save As, type a path and filename for the file, then click OK.

When you are finished creating and saving the script file, you are ready to use the Play option on the Script pull-down menu to compile the file. If the script has not yet been saved, the Play option changes to Save and Play.

Tips

•	In step 2, if you insert a Create command (such as Create /FS=FAT), click Insert [image] Command [image] Create, then select an option from the menu, the Create command is inserted into the script edit pane. The Create command may need more information (parameters) than what is provided by the inserted command. You can add parameters that let you create a partition with the specifications you want. For example, you can add a label, size, or position parameter.

To add a parameter right-click anywhere on the Create line in the script edit pane, click Insert Parameter, then select the parameter you want to add to the line.

•	To replace an incorrect parameter in a command, right-click on the selected (highlighted) parameter. Click Insert Parameter, then select the new parameter you want.

•	To delete syntax, select the line you want to remove in the script edit pane, then press <Delete>.

•	You can click Edit [image] Undo to reverse an editing action.

•	Right-click in the script edit pane for a list of quick menu options.

•	Instead of creating a script by selecting items from the Insert menu in ScriptBuilder, you can "record" the script using PartitionMagic. Click See Also on the Help toolbar for more information.


To record a new script
To record a new script,

Instead of creating a script by selecting items from the Insert menu in ScriptBuilder, you can "record" a script while you use PartitionMagic.

1	From PartitionMagic, click Tools [image]  Scripting [image]  Record.

2	Select options in PartitionMagic as you normally would.

When you select an option, the associated script command is sent to ScriptBuilder and inserted into the script edit pane at the current cursor location.

3	When you are finished recording, deselect Record in PartitionMagic to turn off recording.

4	From ScriptBuilder, save the script file.

Tips

•	In step 2, some operations may be dimmed (unavailable) while you are recording a script. Dimmed operations are not record able in a script.

•	In step 3, you may be prompted to discard any virtual changes you made to your machine while recording the script. If so, click Yes to erase all changes, or click No to apply all changes. Regardless of whether you click Yes or No, your script will remain intact.


About Open

Use Open to open a ScriptBuilder file (.PQS) that you have created and saved. The name of the open script file appears in the title bar area of ScriptBuilder. You can open one script file at a time.

 To open a script file


To open a script file
To open a script file,

1	From PartitionMagic, click Tools [image] Scripting [image] ScriptBuilder.

2	From ScriptBuilder, click File [image] Open.

3	Specify the path and filename of the script file you want to open.


About Save and Save As

Use Save to save the currently opened script file. Use Save As to save a script as a new file, or to save the script with a new filename, or save it in a different folder location.

Scripts are saved with a .PQS file extension by default, however, you can save the file with any file extension you want.

 To save a script file


To save a script file
To save a script file,

1	From ScriptBuilder, click File [image] Save.

2	Specify a path and filename, if necessary.

Tips

•	Click File [image] Save As to save the script as a new file, or to save the script with a new filename, or to save it in a different folder location.


About Close

Use Close to quit ScriptBuilder, save the changes to your script file, and return to PartitionMagic.

 To close ScriptBuilder


To close ScriptBuilder
To close ScriptBuilder,

1	Click File [image] Close.

2	Click Yes to save changes, then specify a path and filename for the document, if necessary.


About Undo

Use Undo to reverse the last change you made in the script file pane, during the current session.

 To undo changes

 To delete a line


To delete a line
To delete a line,

1	From ScriptBuilder, select one or more lines of syntax in the script edit pane.

2	Click Edit [image] Delete.

Tips

•	You can also right-click anywhere in the script edit pane to display a menu of options that includes Delete, or you can simple press <Delete> on the keyboard.


To undo changes
To undo changes,

1	From ScriptBuilder, click Edit [image] Undo to reverse any changes you made in the script edit pane, during the current session.

Tips

•	You can also right-click anywhere in the script edit pane to display a menu of options that includes Undo.


About Cut, Copy, and Paste

Use Cut with Paste to remove a selected command, query, or statement, then paste it in another location in the script edit pane.

Use Copy with Paste to copy a selected command, query, or statement, then paste the copy in another location in the script edit pane.

When you cut or copy syntax, the information remains in the Clipboard until you cut or copy new syntax or until you exit Windows.

 To cut and paste syntax

 To copy and paste syntax


To cut and paste syntax
To cut and paste syntax,

1	From the script edit pane in ScriptBuilder, select the syntax to cut.

2	Click Edit [image] Cut to add the syntax to the Clipboard.

3	Position the insertion point in the script edit pane where you want the cut syntax to appear, then click Edit [image] Paste.

Tips

•	In step 2, you can also right-click the selected syntax, then click Cut.

•	In step 3, you can also right-click at the insertion point, then click Paste.


To copy and paste syntax
To copy and paste syntax,

1	From the script edit pane in ScriptBuilder, select the syntax to copy.

2	Click Edit [image] Copy to add the syntax to the Clipboard.

3	Position the insertion point in the script edit pane where you want the copied syntax to appear, then click Edit [image] Paste.

Tips

•	In step 2, you can also right-click the selected text, then click Copy.

•	In step 3, you can also right-click at the insertion point, then click Paste.


About Delete

Use Delete to remove selected syntax from the script edit pane.

 To delete syntax


About Select All

Use Select All to select (highlight) all syntax in the script edit pane. This is useful for deleting all syntax at once or if you want to cut or copy the syntax to another text editor.

 To select all syntax


To select all syntax
To select all syntax,

1	From ScriptBuilder, click Edit [image] Select All.

Tips

•	You can also right-click anywhere in the script edit pane to display a menu of options that includes Select All.

•	To select specific syntax, move the pointer to the start of the information, drag across the syntax, then release the mouse button.


About Find and Replace

Use Find and Replace to find words or characters in your script and replace them with other words or characters. When you search for a word or character you can use Find Next to continue searching forward in the script.

 To find and replace syntax


To find and replace syntax
To find and replace syntax,

1	From ScriptBuilder, click Edit [image] Find and Replace.

2	Type the word or phrase you want to search for in the script edit pane.

3	Type the replacement word or phrase.

4	Click Up or Down for the search direction in the script edit pane.

5	To replace all instances of the text, click Replace All. To replace certain instances of the text, click Find Next, then click Replace.

Tips

•	You can add a space before and after the search word to avoid finding the letters you have typed within other words (for example, "it" appearing in "item," "with," and "quit").

•	To delete all instances of the text, you can type the word or phrase in the Text to find text box and leave the Replace with text box empty.

•	If you just want to find a word or phrase, click Find Next after step 2.

•	Select Match case to find instances that match the capitalization of the word or phase you type in step 2.

•	You can copy syntax from the script edit pane to the Clipboard. Then, in steps 2 or 3 you can press Ctrl+V to paste the information.

•	When you close the Find and Replace dialog box, you can continue to search for text in the script edit pane by clicking Edit [image] Find Next, or by pressing <F3>.


About Play

Use Play to run the script file that is currently open in ScriptBuilder. You can also play a script file from PartitionMagic, without having to open ScriptBuilder.

 To play a script


To play a script
To play a script,

1	From ScriptBuilder, click Script [image] Play or Save and Play (if you have not saved the script prior to running it).

Tips

•	To play a script file from PartitionMagic (without opening ScriptBuilder), click Tools [image] Scripting [image] Play Script File, specify the path and filename of the .PQS file you want to run, then click Play.

•	To play a script file without opening PartitionMagic, you can pass the script filename to the program, on the command line. If the program encounters an error, the script will end immediately. You can determine if an error has occurred and what error it was by looking at the log file or error file. These two files are only created if you specify them on the command line.


About Check Syntax

Use Check Syntax to test the entire syntax in the script for errors. Any errors in the syntax are listed in the error pane directly below the script edit pane.

You can increase or decrease the viewing area of either pane by dragging the horizontal separator bar up or down.

 To test the syntax in the script


To test the syntax in a script
To test the syntax in a script,

1	From ScriptBuilder, click Script [image] Syntax Check.

Tips

•	The syntax in a script is automatically checked when you open or play a script file in ScriptBuilder.


About Stop

Use Stop to cancel running a script or to end a syntax check before it finishes.

 To cancel a script run or syntax check


To stop playing a script or a syntax check
To stop playing a script or a syntax check,

1	From ScriptBuilder, click Script [image]  Stop.

Tips

•	You can also press <Esc>, or click Cancel on the status bar.


Using Command Line Options

Besides using the Play option in ScriptBuilder to run a script, you can use the following supported command line options in the DOS version of PartitionMagic. When you specify multiple options, the order is not important.

All commands must be contained within one line. They cannot start on one line and finish on the next. The maximum length of a script line is 180 characters.

The following examples use the required syntax for PartitionMagic for DOS (PQMAGIC.EXE), but all command line options are valid for all versions of PartitionMagic (PMAGIC9X.EXE and PMAGICNT.EXE).

Option	Description
/CMD	Use /CMD (command) to pass the name of the script file to the program. For example, if the filename of the script was SCRIPT.TXT, the syntax for playing the program from the script would be: PQMAGIC /CMD=SCRIPT.TXT
/LOG	Use /LOG in conjunction with /CMD to review exactly what happened when a script was playing. The /LOG parameter will specify the name of a file where all output will be placed. The output will appear as if a user played the program through keyboard input, displaying each script command and its result.  For example, to specify a log named RESULTS.FIL (with the script file named above), you would type the following on the command line: PQMAGIC /CMD=SCRIPT.TXT /LOG=RESULTS.FIL
/ERR	Use /ERR (error) to create an error file if the program ends with an error. Because many operations require rebooting a machine after playing a script, it will not always be possible to return the error to the process that called the PQMAGIC program. For this reason, if the program ends in an error and the /ERR parameter is specified, the error number will be placed in the file designated by /ERR. If /ERR is specified and the program ends without error, the file specified will be deleted if it exists. Using this parameter, you can write a program to check the existence of the error file to determine if the script was played successfully. Even if this parameter is not used, the error number will appear in the log file (if specified by /LOG) along with a text description of the error that occurred. To use /ERR with the above parameters, you would type the following on the command line: PQMAGIC /CMD=SCRIPT.TXT /LOG=RESULTS.FIL /ERR=ERROR.FIL
/NRF	Use /NRF (no run file) to specify the name of a file which, if it exists, will prevent the script from playing. This parameter is used to prevent the program from playing a second time, if it were placed in a login script or AUTOEXEC.BAT file. If the user specifies a /LOG file or an /ERR file, the /NRF can check for these files and prevent the program from playing if either existed. For example, suppose you played a script using the parameters specified below. If the RESULT.FIL existed (because the program had been run once already) the script would stop playing. (Please note that the following example would need to be contained on a single line if you were to type it. It wraps here only as a result of the formatting of this online Help.) PQMAGIC /CMD=SCRIPT.TXT /LOG=RESULTS.FIL /ERR=ERROR.FIL /NRF=RESULTS.FIL  You can use the /NRF parameter more than once on the command line if it makes sense to check for more than one file.
/SCO	Use /SCO (syntax check only) to check the syntax of a script. It ensures that a partition is always selected before an operation is played and checks the syntax of all the script commands. It will not actually play the script. The syntax check will not detect logical errors that are specific to a disk, such as trying to move the partition when there is not space to move. This parameter can be used with the /LOG file if you want. A successful syntax check will show a statement saying that it was successful. To use /SCO, you would type the following on the command line: PQMAGIC /CMD=SCRIPT.TXT /SCO


PowerQuest Technical Support

Before contacting PowerQuest, please try to resolve problems you encounter by using the online Help, the user guide, the README file, and PowerQuest's corporate web site.

Tips

•	Your problem may be resolved by applying the most recent patch or upgrade of the software. You can download patches and upgrades from http://www.powerquest.com/updates.

•	PowerQuest technical support engineers may request information from the PartitionInfo utility program to help you resolve problems with PowerQuest software. The PartitionInfo report is always required for errors 100-199, 255, 986, and drive detection errors of any kind.

•	Your product serial number is required to obtain technical support.

•	If you received a demo or trial version of the PowerQuest software, you are not entitled to complimentary technical support.

Term of Technical Support

Technical support is available to all registered users throughout the life of the product, which began when PowerQuest released the software to manufacturing and ends six months after the release of the next version of the software or when PowerQuest discontinues its development.

Upon registration, PowerQuest provides 45 days of complimentary technical support from the day of your first call.

Corporate Web Site

The Technical support web site, http://support.powerquest.com, includes an overview of support options, an e-mail support request form, a list of error messages and information to resolve problems you encounter, and answers to frequently asked questions about the product.

E-mail

Language	E-mail address (for specific technical problems)
Dutch	eurots@powerquest.com
English	help@powerquest.com  eurots@powerquest.com
French	france@powerquest.com
German	germany@powerquest.com
Italian	italian@powerquest.com
Portuguese	latina@powerquest.com
Spanish	spanish@powerquest.com
To obtain e-mail technical support for specific technical questions, you can fill out the form at http://support.powerquest.com (available in English only). If you send the information from PartitionInfo with your e-mail message, a PowerQuest technician will be able to assist you more easily. Refer to the product user guide or online Help for information about PartitionInfo.

E-mail on Demand

PowerQuest maintains an e-mail on demand system to resolve common problems. You can view a list of available documents at http://support.powerquest.com. To request one of the documents, send an e-mail message to support@powerquest.com with the index number of the document in the subject of the message. You can only request one document per e-mail message. E-mail on demand documents are available in English only.

Fax

Location	Number
USA	+1 (801) 437-4218
Europe	+31 (0)20 581 9270
Fax a description of your problem to the technical support fax number. This service is available in the United States, Canada, and Europe 24 hours, 7 days. PowerQuest technicians try to respond to all fax requests within 24 hours.

Telephone

Language	Location	Number
Dutch	Netherlands	+31 (0)20 581 3906
English	Netherlands	+31 (0)20 581 3907
English	UK	+44 (0)17 1341 5517
English	USA	+1 (801) 226-6834
French	France	+33 (0)1 69 32 49 30
German	Germany	+49 (0)069 66 568 516
Italian	Italy	+39 (0)02 45 28 1312
Portuguese	USA	+1 (801) 226-6834
Spanish	Spain	+34 (0)91 662 3146
Spanish	USA	+1 (801) 226-6834
The USA call center is open Monday through Friday, 7 a.m. to 6 p.m., MST/MDT. Our European call centers are open Monday through Friday from 9:00 to 18:00, CET.

If you have the information from PartitionInfo ready when you call, a PowerQuest technician will be able to assist you more easily. Refer to the product user guide or online Help for information about PartitionInfo.

Postal Service Mail

USA	Europe
PowerQuest Corporation	PowerQuest Customer Service
P.O. Box 1911	P.O. Box 58287
Orem, Utah 84059-1911	1040 HG
U.S.A.	Amsterdam
	The Netherlands
Please include the information from PartitionInfo with a description of your problem. Also include a return address, a daytime phone number, or other relevant contact information.


Script File Statements

Several special characters are used when describing the syntax of script file statements.

Character	Denotes
{ }	A required parameter
[ ]	An optional parameter
|	A choice among two or more options
//	Comment (in the C++ form). Comments can be either a full line or after a valid statement.
Script file statements are not case-sensitive.

What type of script file statements do you want to insert?

 Commands

 Queries

 Statements


Commands

1	From ScriptBuilder, click Insert [image] Command.

2	Select a command you want to insert (see Options below).

3	If necessary, specify any other command options you want to add to the script.

Tips

•	If a parameter in a command requires a numeric value, you can substitute the value for a Get query or numeric expression (for example, /Size=GetSelectedUnallocatedSize / 2).

Options

Click the option below to read more about it and any related parameters associated with the option.

Allow Manual Reboot	Info
Bad Sector Retest	Label
Check	Merge
Cluster Analyzer	Move Left/Right
Convert to	Resize Partition
Copy	Resize Root
Create	Select
Delete	Set
Format	Show
Hide	Unhide


Allow Manual Reboot

Command	Syntax	Description
Allow Manual Reboot	Allow Manual Reboot	Allow the script to run even if it is determined that the program can not reboot the machine remotely, after changes are made. This should be the first statement if used.

There are no parameters.


Bad Sector Retest

Command	Syntax	Description
Bad Sector Retest	Bad Sector Retest	Retest the current partition for bad sectors and unmark any bad sectors that have been set incorrectly.

There are no parameters.


Check

Command	Syntax	Description
Check	Check	Check the partition for errors.

There are no parameters.


Cluster Analyzer

Command	Syntax	Description
Cluster Analyzer	Cluster Analyzer	Use to get cluster analysis information about a particular partition.
Parameter
Parameter | Set Cluster Size | { Recommended | 512 | 1 | 2 | 4 | 8 | 16 | 32 | 64}	/SetClusterSize= {Recommended | 512 | 1 | 2 | 4 | 8 | 16 | 32 | 64}	Changes the cluster size to the specified size.

If this operation is used without any parameters, a Cluster Analysis screen will display.


Convert to

Command	Syntax	Description
Convert to | FAT	Convert to FAT	Convert a FAT32 or NTFS partition to a FAT partition
Convert to | FAT32	Convert to FAT32	Convert a FAT or NTFS partition to a FAT32 partition.
Convert to | HPFS	Convert to HPFS	Convert a FAT partition to a HPFS partition.
Convert to | NTFS	Convert to NTFS	Convert a FAT partition to a NTFS partition. Under Windows 2000, you can convert a FAT32 partition to a NTFS partition.
Convert to | Primary	Convert to Primary	Convert a primary partition to a logical partition.
Convert to | Logical	Convert to Logical	Convert a logical partition to a primary partition.

There are no parameters.


Copy

Command	Syntax	Description
Copy	Copy	Use Copy to make an exact duplicate of a partition.

For the Copy command to work correctly you need to select a partition and some unallocated space.

If the selected partition is valid and the selected unallocated space is large enough to hold the partition, the selected partition will be copied to the specified unallocated space.

Tips

•	The Copy command should be preceded by the following syntax in the script edit pane:

Select Partition {{Number} | {PartitionLetter} | "Volume Label" | First | Last | Next | Previous | Extended}

•	When you are copying to a different disk use the following syntax in the script edit pane:

Select Destination Disk

Select Destination Unallocated {{Number} | First | Last | Largest | After Partition {Number} | Before Partition {Number} | Next | Previous}

•	When you are copying to the same disk use the following syntax in the script edit pane:

Select Unallocated {{Number} | First | Last | Largest | After Partition {Number} | Before Partition {Number} | Next | Previous}


Create

Create a new partition, and (optionally) format it.

Command	Syntax	Description
Create | {FAT | FAT32 | HPFS | NTFS | LinuxExt2 | LinuxSwap | Extended | Unformatted}	Create /FS={FAT | FAT32 | HPFS | NTFS | LinuxExt2 | LinuxSwap | Extended | Unformatted}	The file system can be any of the above specified strings. There may be cases where creating with a certain /FS would fail. For example, trying to create an extended partition when one already exists.
Parameter
Parameter | Label	/Label="{Put_Name_Here}"	(Optional) Replace "Put_Name_Here" with the volume label you want. It must be 11 characters or less for FAT partitions. Labels must be 16 characters or less for LinuxExt2 partitions and 32 characters or less for NTFS partitions. The label must be in double quotes. The script may fail if invalid characters are entered.
Parameter | Size	/Size={Put_Value_Here}	(Optional) Specified in megabytes and will default to the size of the unallocated space if not specified.
Parameter | Position | {Beginning | End}	/Position={Beginning | End}	(Optional) Must be followed by either Beginning or End to specify where the partition will be created in the unallocated space. Beginning is the default value.


Delete

Use to delete a partition.

Command	Syntax	Description
Delete | All	Delete All	A volume name is required to delete a partition unless the partition is an extended partition, a Linux swap partition, or an unformatted partition. This is a check to ensure that you are destroying data in the proper partition only. The value entered must always be preceded and followed by double quotes. If the partition label is blank and the partition type is FAT, FAT32, HPFS, NTFS, LinuxExt2, or Linux Swap, the labeled entered should be "No Name". If the partition is not one of the types mentioned above, then the labeled entered should be "Unknown".
Delete | No name	Delete "No Name"
Delete | Unknown	Delete "Unknown"
Delete | {Volume}	Delete "{Put _Name_Here}"


Format

Use to format a partition.

Command	Syntax	Description
Format | No name | {FAT | FAT32 | HPFS | NTFS | LINUXEXT2 | LINUXSWAP}	Format "No Name" /FS={ FAT | FAT32 | HPFS | NTFS | LINUXEXT2 | LINUXSWAP}	Volume name is required to format a partition unless the partition is an extended partition or an unformatted partition. This is a check to ensure that you are destroying data in the proper partition only. The value entered must always be preceded and followed by double quotes. If the partition label is blank and the partition type is FAT, FAT32, HPFS, NTFS, LinuxExt2, or Linux Swap, the labeled entered should be "No Name". If the partition is not one of the types mentioned above, then the labeled entered should be "Unknown". The file system can be any of the above-specified strings. There may be cases where formatting with a certain /FS would fail, for example trying to format a FAT partition past 1024 cylinders.
Format | Unknown | {FAT | FAT32 | HPFS | NTFS | LINUXEXT2 | LINUXSWAP}	Format "Unknown" /FS={ FAT | FAT32 | HPFS | NTFS | LINUXEXT2 | LINUXSWAP}
Parameter
Parameter | Label	/Label="{Put_Name_Here}"	(Optional) Replace "Put_Name_Here" with the desired volume label. It must be 11 characters or less for FAT partitions. Labels must be16 characters or less for LinuxExt2 partitions and 32 characters or less for NTFS partitions. The label must be in double quotes. The script may fail if invalid characters are entered.


Hide

Command	Syntax	Description
Hide	Hide	Hide the currently selected partition.

There are no parameters.


Info

Command	Syntax	Description
Info	Info	Use Info to get detailed information about a selected partition. If you do not use any parameters it is the same as specifying all parameters. Use the following parameters only if you want specific information.
Parameter
Parameter | Usage	/Usage	The Disk Usage screen is available for the FAT, FAT32, NTFS, and HPFS file systems. Displays the following information in bytes, megabytes, and as a percentage: • Used space on the partition, including space wasted by clusters • Free space on the partition • Bad space on the partition • Total space on the partition (found by adding the three previous lines)
Parameter | Waste	/Waste	The Cluster Waste screen applies only to partitions that use either the FAT or FAT32 file system. Displays the following information: • Current cluster size in bytes or kilobytes • Data stored on the partition in bytes and megabytes • Wasted space on the partition in bytes and megabytes Total Used space in bytes and megabytes (found by adding the numbers on the two previous lines)
Parameter | Partition	/Partition	Displays information about the partition type, including free space and extended partitions. Information on this tabbed page includes the following: • Partition type is shown in hexadecimal followed by a text description of the partition or file system type (such as FAT, FAT32, NTFS, HPFS, and so on). The hexadecimal designation is a conventional way to display partition types. • Serial number is shown here if the partition's file system uses serial numbers. Not all file systems use serial numbers. The next section of the screen shows physical information about the partition, including the following: • First Physical Sector shows the logical number and the location (cylinder, head, and sector) where the partition begins. • Last Physical Sector shows the logical number and the location (cylinder, head, and sector) where the partition ends. • Total Physical Sectors gives the number of sectors in the partition. • Physical Geometry shows the number of cylinders, heads, and sectors of the physical disk drive on which the partition resides.
Parameter | File System	/FS	Displays information about the selected partition's file system as it pertains to the operating system.


Label

Command	Syntax	Description
Label	Label	Use Label to change a partition's volume label. Labels are shown in all uppercase letters. The following parameter is optional.
Parameter
Parameter | Get Label	/GetLabel	Display the partition's current volume label.
Parameter | Set Label	/SetLabel="{Put_Name_Here}"	Specify the partition's volume lable.

The maximum number of alphanumeric characters and the types of characters permitted depend on the partition type.

Partition Type	Maximum Number of Alphanumeric Characters	Invalid Characters
FAT16, FAT32, HPFS	11	*?[]<>|+=:;,.\ /"
NTFS	32	None
Linux Ext2	16	None


Merge

Use Merge to join two FAT or FAT32 partitions that are adjacent (unallocated space can exist between them, however) to each other on a hard disk. This is useful if you have reached the maximum number of partitions on your disk, but you do not want to delete a partition.

The Merge command must be preceded by the following syntax in the script edit pane:

Select Partition {{Number} | {PartitionLetter} | {"Volume Label"} | First | Last | Next | Previous | Extended}

Select Merge Partition {Next | Previous}

For the Merge command to work correctly, two adjacent FAT or FAT32 partitions must be selected.

Command	Syntax	Description
Merge | Target First	Merge /Target=First /Folder="{Put_Name_Here}"	(Required) Specify the first partition (as they occur on the physical disk) as the target partition for the other. Also, specify the folder name that contains the merged partition.
Merge | Target Second	Merge /Target=Second /Folder="{Put_Name_Here}"	(Required) Specify the second partition (as they occur on the physical disk) as the source partition. Also, specify the folder name that contains the source partition.
Parameter
Parameter | File System | {FAT | FAT32}	/FS={FAT | FAT32}	(Optional) You can specify the resulting file system, or you can let Merge choose the best file system automatically.


Move

If a parameter requires a numeric value, you can substitute the value for a Get query or numeric expression.

Move Left {Max | Min | {Value}}

Use Move Left to move a partition to the left. If the partition is the extended partition, only the right boundary is changed.

Command	Syntax	Description
Move | Left | Max	Move Left Max	Move the partition as far to the left as possible. Flush with the previous partition or the beginning of the disk.
Move | Left | Min	Move Left Min	Move the partition left, the minimum amount possible (1 cylinder)
Move | Left | {Value}	Move Left {Put_Value_Here}	Move the partition left by the specified value (in megabytes)
Move Right {Max | Min | {Value}}

Use Move Right to move a partition to the right. If the partition is the extended partition, only the right boundary is changed.

Command	Syntax	Description
Move | Right | Max	Move Right Max	Move the partition as far to the right as possible. Flush with the previous partition or beginning of the disk.
Move | Right | Min	Move Right Min	Move the partition right, the minimum amount possible (1 cylinder)
Move | Right | {Value}	Move Right {Put_Value_Here}	Move the partition right by the specified value (in megabytes)
Move Space After {Max | {Value}}

Same as Move Left.

Command	Syntax	Description
Move | Space After | Max	Move Space After Max	Same as Move Left Max. Makes as much space as possible before the partition by moving the partition right.
Move | Space After | {Value}	Move Space After {Put_Value_Here}	Moves the partition left so that the space before is equal to the value specified, if possible (in megabytes).
Move Space Before {Max | {Value}}

Same as Move Right

Command	Syntax	Description
Move | Space Before | Max	Move Space Before Max	Same as Move Right Max. Makes as much space as possible before the partition by moving the partition right.
Move | Space Before | {Value}	Move Space Before {Put_Value_Here}	Moves the partition right such that the space before is equal to the value specified if possible (in megabytes).


Resize Partition

If a parameter requires a numeric value, you can substitute the value for a Get query or numeric expression (for example, Resize GetSelectedPartitionSize * 2)

Resize Partition {Max | Min | {Value}} [/Clustersize={512 | 1 | 2 | 4 | 8 | 16 | 32 | 64}]

Use to resize a partition.

Command	Syntax	Description
Resize Partition | Max	Resize Max	Resizes to the maximum size possible (Right edge will be flush with end of disk or the next partition, if possible)
Resize Partition | Min	Resize Min	Resizes to the minimum possible (determined by the size of the data)
Resize Partition | {Value}	Resize {Put_Value_Here}	Resize to value specified (in megabytes)
Parameter
Parameter | Set Cluster Size	/SetClusterSize={512 | 1 | 2 | 4 | 8 | 16 | 32 | 64}	Sets the cluster size to the size specified during the resize operation. (The cluster size must be valid for the partition size specified.)
Resize Partition Clusters {Max | Min | {Value} | 512 | 1 | 2 | 4 | 8 | 16 | 32 | 64}]

Change the cluster size of a FAT partition.

Command	Syntax	Description
Resize Partition | Clusters | Max	Resize Clusters Max	If specified, the partition will be modified to use the largest cluster size possible.
Resize Partition | Clusters | Min	Resize Clusters Min	If specified, Min will change the partition to the minimum partition size possible. This may also require the partition size to change. If needed, the partition size will be changed.
Resize Partition | Clusters	Resize Clusters | {512 | 1 | 2 | 4 | 8 | 16 | 32 | 64}	The value can be 512, 1, 2, 4, 8, 16, 32, or 64. If the cluster size specified requires the partition to change size, the Resize Clusters operation will resize the partition as well.
Resize Partition Larger {Max | Min | {Value}} [/Clustersize={512 | 1 | 2 | 4 | 8 | 16 | 32 | 64}]

Resize a partition larger by specifying the incremental change in size.

Command	Syntax	Description
Resize Partition | Larger | Max	Resize Larger Max	Same as Resize Max. Partition as big as possible
Resize Partition | Larger | Min	Resize Larger Min	Grows the size of the partition by the smallest amount possible (1 cylinder)
Resize Partition | Larger | {Value}	Resize Larger {Put_Value_Here}	Grows the size of the partition by the size specified (in Megabytes)
Parameter
Parameter | Set Cluster Size	/SetClusterSize={512 | 1 | 2 | 4 | 8 | 16 | 32 | 64}	Sets the cluster size to the size specified during the resize operation. (The cluster size must be valid for the partition size specified.)

Resize Partition Smaller {Max | Min | {Value}} [/Clustersize={512 | 1 | 2 | 4 | 8 | 16 | 32 | 64}]

Resize a partition smaller by specifying the incremental change in size. See also, Resize above.

Command	Syntax	Description
Resize Partition | Smaller | Max	Resize Smaller Max	Same as Resize Min Partition as small as possible.
Resize Partition | Smaller | Min	Resize Smaller Min	Partition's size will be decreased by the minimum amount possible (1 cylinder).
Resize Partition | Smaller | {Value}	Resize Smaller {Put_Value_Here}	Partition's size will be decrease by the amount specified. (in Megabytes).
Parameter
Parameter | Set Cluster Size	/SetClusterSize={512 | 1 | 2 | 4 | 8 | 16 | 32 | 64}	Sets the cluster size to the size specified during the resize operation. (The cluster size must be valid for the partition size specified.)
Resize Partition Left Boundary {Max | Min | {Value}}

Resize the extended partition by moving the left boundary. This operation is for extended partitions only.

Command	Syntax	Description
Resize Partition | Left Boundary | Max	Resize Left Boundary Max	Resizes to the maximum size possible (Right edge will be flush with end of drive or the next partition, if possible)
Resize Partition | Left Boundary | Min	Resize Left Boundary Min	Resizes to the minimum possible (determined by the size of the data)
Resize Partition | Left Boundary | {Value}	Resize Left Boundary {Put_Value_Here}	Resize to value specified (in megabytes)
Resize Partition Left Boundary Larger {Max | Min | {Value}}

Resize an extended partition larger by specifying the change in position of the left boundary. This operation is for extended partitions only. See also Resize Left Boundary above.

Command	Syntax	Description
Resize Partition | Left Boundary | Larger | Max	Resize Left Boundary Larger Max	Same as Resize Left Boundary Max. Partition as large as possible
Resize Partition | Left Boundary | Larger | Min	Resize Left Boundary Larger Min	Grow the size of the partition by the smallest amount possible (1 cylinder)
Resize Partition | Left Boundary | Larger | {Value}	Resize Left Boundary Larger {Put_Value_Here}	Grow the size of the partition by the size specified (in megabytes)
Resize Partition Left Boundary Smaller {Max | Min | {Value}}

Resize an extended partition smaller by specifying the change in position of the left boundary. This operation is for extended partitions only. See also Resize Left Boundary Larger above.

Command	Syntax	Description
Resize Partition | Left Boundary | Smaller | Max	Resize Left Boundary Smaller Max	Same as Resize Left Boundary Min. Partition as small as possible
Resize Partition | Left Boundary | Smaller | Min	Resize Left Boundary Smaller Min	Partition's size will be decreased by the minimum amount possible (1 cylinder)
Resize Partition | Left Boundary | Smaller | {Value}	Resize Left Boundary Smaller {Put_Value_Here}	Partition's size will be decreased by the amount specified. (in megabytes)
Resize Space After {Max | Min | {Value}} [/Clustersize={512 | 1 | 2 | 4 | 8 | 16 | 32 | 64}]

Resize a partition by specifying the unallocated space you want following the partition, after resizing. See also Resize above.

Command	Syntax	Description
Resize Partition | Space After | Max	Resize Space After Max	Resizes so that the space after the partition is as large as possible (Partition is as small as possible)
Resize Partition | Space After | Min	Resize Space After Min	Resizes so that the space after the partition is as small as possible (Partition is as large as possible)
Resize Partition | Space After | {Value}	Resize Space After {Put_Value_Here}	Sizes the partition such that the space after is the size of value (in megabytes)
Parameter
Parameter | Set Cluster Size	/SetClusterSize={512 | 1 | 2 | 4 | 8 | 16 | 32 | 64}	Sets the cluster size to the size specified during the resize operation. (Cluster size must be valid for the partition size specified)
Resize Space Before {Max | Min | {Value}}

Resize an extended partition by specifying the unallocated space you want before the partition, after resizing. This operation is for extended partitions only.

Command	Syntax	Description
Resize Partition | Space Before | Max	Resize Space Before Max	Resizes so that the space before the partition is as large as possible (The partition is as small as possible)
Resize Partition | Space Before | Min	Resize Space Before Min	Resizes so that the space before the partition is as small as possible (The partition is as large as possible)
Resize Partition | Space Before | {Value}	Resize Space Before {Put_Value_Here}	Sizes the partition such that the space before is the size of value (in megabytes)


Resize Root

Change the number of entries in the root directory of a FAT partition.

Command	Syntax	Description
Resize Root | Max	Resize Root Max	Sets the maximum number of root entries for the partition to the largest number possible.
Resize Root | Min	Resize Root Min	Sets the minimum number of root entries for the partition to the largest minimum number possible.
Resize Root | Value	Resize Root {Put_Value_Here}	Specify a value between 512-1024. This will change the maximum number of root entries possible for this partition. The number actually set will be the closest number possible to the number specified.


Select

Command	Syntax	Description
• Select | Disk {Number}	Select Disk {Put_Value_Here}	Select a hard disk.
• Select | Partition | [{Number} | {Letter} | {"Volume"} | First | Last | Next | Previous | Extended}]	Select Partition {Put_Value_Here} Select Partition {Put_Letter_Here} Select Partition "{Put_Name_Here}" Select Partition First Select Partition Last Select Partition Next Select Partition Previous Select Partition Extended	Select a partition.
• Select | Unallocated | [{Number} | First | Last | Largest | Next | Previous | After Selected Partition | Before Selected Partition}]	Select Unallocated {Put_Value_Here} Select Unallocated First Select Unallocated Last Select Unallocated Largest Select Unallocated Next Select Unallocated Previous Select Unallocated After Selected Partition Select Unallocated Before Selected Partition	Select unallocated space on the partition.
• Select | Merge Partition | {Next | Previous}	Select Merge Partition Next Select Merge Partition Previous	Select a partition to merge with an adjacent partition.
• Select | Destination | Disk {Number}	Select Destination Disk {Put_Value_Here}	Select the destination hard disk
• Select | Destination | Unallocated | {{Number} | First | Last | Largest | After Partition {Number} | Before Partition {Number} | Next | Previous}	Select Destination Unallocated {Put_Value_Here} Select Destination Unallocated First Select Destination Unallocated Last Select Destination Unallocated Largest Select Destination Unallocated After Partition {Put_Value_Here} Select Destination Unallocated Before Partition {Put_Value_Here} Select Destination Unallocated Next Select Destination Unallocated Previous	Select the destination for unallocated space on the partition.

There are no parameters.

Tips

•	You do not need to select a disk when selecting a partition by Letter or Volume. All the disks are searched in order until the specified Letter or Volume Name is encountered. This means that if two partitions have the same Volume Name, the first partition found is the one that is selected.

•	The Next and Previous commands are relative to a previous selection of the same type. You must already have a partition selected before using Select Partition Next or Select Partition Previous. Likewise, you must have an unallocated space selected before using Select Unallocated Next or Select Unallocated Previous.


Set

Command	Syntax	Description
Set | Active	Set Active	Mark the selected partition as the active, or bootable, partition.
Set | Default Bad Sector Test State {On | Off}	Set Default Bad Sector Test State On Set Default Bad Sector Test State Off	Set the bad sector testing on or off for all partitions on the currently selected disk.
Set | Disk Read Only Mode {On | Off}	Set Disk Read Only Mode On Set Disk Read Only Mode Off	Set the read-only flag on or off for all partitions on the currently selected disk. When set on for a disk, any modifications to partitions are not allowed. Some changes to BOOT.INI files are allowed if they exist on the read-only disk when add, delete, or copy partition operations are done.
Set | Ignore OS/2 EA Errors {On | Off}	Set Ignore OS/2 EA Errors On Set Ignore OS/2 EA Errors Off	Tells PartitionMagic whether to ignore OS/2 Extended Attribute errors when checking a FAT partition. Important: If OS/2 is on your computer, do not enable this option. Data loss could occur because problems might go undetected.
Set | NT 64k FAT Clusters {On | Off}	Set NT 64k FAT Clusters On Set NT 64k FAT Clusters Off	If you set NT 64K FAT Clusters to on, you can create FAT partitions with 64 KB clusters, which enables a FAT partition size up to 4 GB on Windows NT. Important: If you are using multiple operating systems, you should not use 64 KB clusters because other operating systems are unable to access the information in the partition. To prevent you from inadvertently creating partitions with 64 KB clusters, this preference is disabled every time you exit PartitionMagic.


Show

Command	Syntax	Description
Show | Partitions	Show Partitions	Displays a summary of the partitions on the selected disk
Show | Preferences	Show Preferences	Displays the current settings for all preferences.
Show | Destination	Show Destination	Displays a summary of the partitions on the selected destination disk.

There are no parameters.


Unhide

Command	Syntax	Description
Unhide	Unhide	Unhide the currently selected partition.
There are no parameters.


Queries

1	From ScriptBuilder, click Insert [image] Query.

2	Select a query option you want to insert (see below).

3	If necessary, specify any other query options you want in the script edit pane.

Tips

•	Queries are inserted into the script edit pane at the location of your cursor and replace any selected text.

•	You can assign values returned from queries to variables or you can use them in conditional or mathematical expressions. For example, in the following code, the variable dNumParts is defined, then assigned the total number of partitions on disk 1.

Dim dNumParts

Select Disk 1

dNumParts = GetTotalPartitions

In the following code example, Partition C: is selected. If the partition is FAT, it is converted to FAT32.

Select Partition C

If IsFAT Then

Convert to FAT32

End If

In the last example of code, the largest unallocated space on disk 1 is selected. If it is larger than 1000 MB, PartitionMagic creates two partitions, each using approximately half of the unallocated space.

Select Disk 1

Select Unallocated Largest

If GetSelectedUnallocatedSize > 1000 Then

Create /FS=FAT /Size = GetSelectedUnallocatedSize / 2

Select Unallocated After Selected Partition

Create /FS=FAT

End If

Query	Syntax	Use to
• Number of Disks	GetTotalDisks	Get the total number of physical disks on the selected disk.
• Number of Partitions	GetTotalPartitions	Gets the total number of partitions on the selected disk.
• Number of Unallocated.	GetTotalUnallocatedSpaces	Gets the total number of unallocated spaces on the selected disk.
• Disk Size	GetDiskSize	Get the size of the currently selected disk, in megabytes.
• Disk Allocated {Size | Percentage}	GetAllocatedSize GetAllocatedPercent	Get the size of disk allocated to partitions, in megabytes or as a percentage.
• Disk Unallocated {Size | Percentage}	GetUnallocatedSize GetUnallocatedPercent	Get the size of remaining unallocated space on the currently selected disk, in megabytes or as a percentage.
• Partition Size	GetSelectedPartitionSize	Get the size of the partition, in megabytes.
• Partition Number {<Number> | <Letter> | <Volume> | First | Last | Next | Previous | Extended}	GetPartitionNumber {Put_Value_Here} GetPartitionNumber {Put_Letter_Here} GetPartitionNumber "{Put_Name_Here}" GetPartitionNumber First GetPartitionNumber Last GetPartitionNumber Next GetPartitionNumber Previous GetPartitionNumber Extended	Get the partition number of the selected partition. You can then use the returned value with the Select Partition {Number} command. A return of "0" indicates that the partition does not exist. (For example, the GetPartitionNumber Extended command returns "0" if there is no extended partition.)
• Partition Used {Amount | Percentage}	GetUsedAmount GetUsedPercent	Get the size of used space on a partition, in megabytes or as a percentage.
• Partition Unused {Amount | Percentage}	GetUnusedAmount GetUnusedPercent	Get the size of unused space on a partition, in megabytes or as a percentage.
• Type {FAT | FAT32 | NTFS | HPFS | Linux Ext2 | Linux Swap | Extended | Unallocated | Unformatted}	IsFAT IsFAT32 IsNTFS IsHPFS IsLinuxExt2 IsLinuxSwap IsExtended IsUnallocated IsUnformatted	Determine if the file system of the current partition is the type specified.
• Status {Active | Hidden}	IsActive IsHidden	Determine if the status of the current partition is active or hidden.
• Primary/Logical {Primary | Logical}	IsPrimary IsLogical	Determine if the class of the current partition is primary or logical.
• Unallocated Size	GetSelectedUnallocatedSize	Get the size of the unallocated space, in megabytes.
• Unallocated Number {<Number> | First | Last | Largest | Next | Previous | After Selected Partition | Before Selected Partition}	GetUnallocatedNumber {Put_Value_Here} GetUnallocatedNumber First GetUnallocatedNumber Last GetUnallocatedNumber Largest GetUnallocatedNumber Next GetUnallocatedNumber Previous GetUnallocatedNumber After Selected Partition GetUnallocatedNumber Before Selected Partition	Get the space number of the specified unallocated space. You can then use the returned value with the Select Partition {Number} command. A return of 0 (zero) indicates that the unallocated space does not exist. (For example, the GetUnallocatedNumber Next command returns 0 if there are no unallocated spaces following the last selection.)


Statements

1	From ScriptBuilder, click Insert [image] Statement.

2	Select a statement you want to insert (see below).

3	If necessary, specify any other statement options you want in the script edit pane.

Statement	Syntax	Use to
Variable	Dim {Put_Variable_Name_Here}	Create a variable of the specified name that you can assign a value for later use in conditional or mathematical expressions. For example, the following lines create a variable named "Number" and assign it the value of 2. Dim Number Number = 2
If...End If	If {Put_Condition_Here} Then // Put commands here Else If {Put_Condition_Here} Then // Put commands here Else // Put commands here End If	Perform different statements depending on the specified conditions. Each If {} Then statement must be followed by an End If statement. The Else If {} Then and Else statements are optional.
Do...Loop While	Do // Put commands here Loop While {Put_Condition_Here}	Perform repeated statements until the condition is false or 0 (zero). The statements between the Do and the Loop While {} commands are always played once before the condition is tested.
Do While...Loop	Do While {Put_Condition_Here} // Put commands here Loop	Perform repeated statements until the condition is false or 0 (zero). The statements between the Do While {} and the Loop commands are never played if the condition is false or 0 the first time it is tested.
Tips

•	Use the Exit Loop command to jump out of a Do...Loop While or a Do While...Loop statement before reaching the end of the loop.


Cluster Script

This script file is an example of performing a cluster analysis and setting the cluster size of selected partitions.

Scenario

A disk contains two primary FAT partitions.

The user wants to view an analysis of the partitions, set the cluster size of the first partition to 16K and set the cluster size of the second partition to whatever PartitionMagic recommends.

// PartitionMagic Script File

// Show a cluster analysis of the first partition

Select Disk 1

Select Partition 1

Cluster Analyzer

// Set the cluster size to 16K

Cluster Analyzer /SetClusterSize=16

// Show a cluster analysis of the second partition

Select Partition 2

Cluster Analyzer

// Set the cluster size to the recommended value

Cluster Analyzer /SetClusterSize=Recommended


Convert Script

This script file is an example of converting a partition to a different file system type.

Scenario

A disk contains a primary C: partition that is 100 MB. There is also a hidden primary FAT partition labeled "WIN NT" that is 200 MB. The rest of the disk is an extended partition that contains two logical partitions, D: and E:.

The user wants to convert the hidden partition from FAT to NTFS and reduce both the C: partition and the hidden partition by 40 MB. The user would like to add 40 MB to the D: partition and use the remaining 40 MB to create a logical NTFS partition at the end of the extended partition.

Check the partitions for errors before making any changes.

// PartitionMagic Script File

Select Partition C

Check

Select Partition D

Check

Select Partition E

Check

// Resize the C: partition to be 40 MB smaller

Select Partition C

Resize Smaller 40

// Resize the hidden partition to be 40 MB smaller, move it next to the C:

// partition and convert it to NTFS

Select Partition "WIN NT"

Move Left Max

Resize 160

Convert to NTFS

// Select the extended partition and move it to fill the unallocated space

Select Partition Extended

Resize Left Boundary Max

// Move the D: partition and make it 40 MB larger

Select Partition D

Move Left Max

Resize Larger 40

// Move the E: partition and create the new NFTS partition

Select Partition E

Move Left Max

Select Unallocated Last

Create /FS=NTFS


Copy Script

This script file is an example of using the Copy script command.

Scenario

An 8 GB disk contains four partitions: A 1 GB Win 95 partition, a 3 GB Apps partition, a 1 GB hidden Win NT partition, and a 3 GB Data partition.

The user has inadvertantly created the Win NT partition beyond the 4 GB boot boundary for this operating system. Therefore, the user wants to copy the Data partition to a second disk, copy the Apps partition to the end of the first disk, and move the hidden Win NT partition to be next to the Win 95 partition. This will allow the user to boot the operating system on the Win NT partition. The original Apps and Data partitions should be deleted and the Win NT partition be resized to fill the unallocated space.

// PartitionMagic Script File

// Select the "Data" partition to be copied to disk 2

Select Partition "Data"

// Select the unallocated space where the partition is to be copied

Select Destination Disk 2

Select Destination Unallocated Largest

// Copy the partition

Copy

// Delete the original "Data" partition that is still the selected partition

Select Partition "Data"

Delete "Data"

// Copy the "Apps" partition to the end of disk 1

Select Partition "Apps"

Select Unallocated Last

Copy

// Delete the original "Apps" partition that is still the selected partition

Select Partition "Apps"

Delete "Apps"

// Move the "Win NT" partition next to the "Win 95" partition

Select Partition "Win NT"

Move Left Max

// Resize the "Win NT" to use the unallocated space

Resize Max


Do-While Script

This script file is an example of using the Do-While script statement.

Scenario

Disk 1 contains a primary partition and an unknown number of logical partitions.

The user wants to take 10 MB of unused space on each logical partition and add the unused space to the primary partition.

// PartitionMagic Script File

// Select the last partition

Select Disk 1

Select Partition Last

// Loop thru the logical partitions and remove any unused space over 50 MB

Do While IsLogical

     If GetUnusedAmount > 50 Then

          Resize Smaller GetUnusedAmount - 50

          Move Right Max

     End If

     Select Partition Previous

Loop

// Resize the extended partition to fit the logical partitions

Select Partition Extended

Resize Left Boundary Min

// Expand the primary partition to include the unused space

Select Partition Previous

Resize Larger Max


Extended Script

This script file is an example of creating an extended partition.

Scenario

A 1.2 GB disk is allocated to a primary C: partition, containing 300 MB of data.

The user wants to change the size of the C: partition to 450 MB and create logical partitions D: and E:. The D: partition should be 300 MB and the E: partition will fill the remaining disk.

// PartitionMagic Script File

// Check the C: partition for errors before making any changes

Select Partition C

Check

// Resize the partition to be 450 MB

Resize 450

// Select the unallocated space and create an extended partition

Select Unallocated After Selected Partition

Create /FS=Extended

// Select the unallocated space within the extended partition and create

// logical partitions

Select Unallocated Next

Create /FS=FAT /Label="Files" /Size=300

Select Unallocated After Selected Partition

Create /FS=Fat /Label="Apps"


If-Then Script

This script file is an example of using the If-Then script statement.

Scenario

Disk 1 contains an unknown amount of unallocated space at the end of the disk.

If more than 300 MB of unallocated space is available, the user wants to create a Linux Ext2 partition and a Linux Swap partition on the disk.

// PartitionMagic Script File

// Select the last unallocated space and check for at least 300 MB available

Select Disk 1

Select Unallocated Last

If GetSelectedUnallocatedSize > 300 Then

     // Space is large enough, so create the new partitions

     Create /FS=LinuxSwap /Size=100 /Position=End

     Select Unallocated Last

     Create /FS=LinuxExt2

End If


Logical Script

This script file is an example of creating a logical partition using space taken from a primary partition

Scenario

A disk contains a primary C: partition and logical partitions D: and E:.

The user wants to take 40 MB of unused space from the C: partition and create a logical partition with "Data" as its label.

// PartitionMagic Script File

// Check the partitions for errors before making any changes

Select Partition C

Check

Select Partition D

Check

Select Partition E

Check

// Resize the C: partition to be 40 MB smaller

Select Partition C

Resize Smaller 40

// Select the extended partition and move it to fill the unallocated space

Select Partition Extended

Resize Left Boundary Max

// Move the D: and E: partitions to the beginning of the extended partition

Select Partition D

Move Left Max

Select Partition E

Move Left Max

// Create the new partition at the end of the extended partition

Select Unallocated After Selected Partition

Create /FS=FAT /Label="Data"


Merge Script

This script file is an example of using the Merge script command.

Scenario

Disk 1 contains 4 FAT partitions, Win 95, Apps, Data, and Files.

The user wants to merge the 4 FAT partitions into one FAT32 partition and have the last three partitions exist as folders in the root directory on the Win 95 partition.

// PartitionMagic Script File

// Select the partitions to be merged

Select Partition "Win95"

Select Merge Partition Next

// Merge the second partition into the first inside an "Apps" folder

Merge /Target=First /Folder="Apps" /FS=FAT32

// Repeat for the third partition

Select Merge Partition Next

Merge /Target=First /Folder="Data" /FS=FAT32

// Repeat for the fourth partition

Select Merge Partition Next

Merge /Target=First /Folder="Files" /FS=FAT32


Resize Script

This script file is an example of using the Resize script command.

Scenario

Primary partitions D: and E: exist next to each other on a disk. There is no unallocated space before or after the E: partition.

The user wants to take 10 MB from D: and add it to E:.

// PartitionMagic Script File

// Check the partitions for errors before making any changes

Select Partition D

Check

Select Partition E

Check

// Select the first partition and make it 10 MB smaller

Select Partition D

Resize Smaller 10

// Select the second partition and move and resize it to be 10 MB larger

Select Partition E

Move Left Max

Resize Larger Max


Script edit pane

This is the script edit pane showing the syntax of a sample script. You can manually type commands, parameters, queries, and statements in this pane, or you can select items from the Insert drop-down menu to build your script.


Message pane

The message pane displays information about the script such as syntax check results and runtime output. You can drag the horizontal pane separator bar to increase or decrease the working and viewing area of the script edit pane.


Status bar

When you check the syntax of a script, this area will display the number of errors found.


Filename

The title bar area of ScriptBuilder displays the filename of the currently opened script file.