Script Commands for Windows Desktop Classic Devices
Use the options and examples below to create powerful script commands.
Legend
| Format | Meaning | 
|---|---|
| text | Enter the command exactly as shown. | 
| text | Replace with the requested information. | 
| [text] | Square brackets indicate optional information for the command. | 
| text|text | Choose one of the options separated by the vertical pipe. | 
Commands
| Command | Syntax | 
|---|---|
| abortpkgHalts the installation of a package and forces the installation status in the SOTI MobiControl console to report "Failed" when used in a SOTI MobiControl pre-install script. See Using Package Studio for more information. | abortpkg | 
| abortsyncWhen used in a SOTI MobiControl pre-sync script, this command stops the file synchronization process. See Using File Sync Policies for more information. | abortsyncExample To abort file synchronization if the first octet of the device's IP address is 169 (when the IP is in the form 169.254.0.1):  | 
| attribDisplays or changes file attributes. | attrib [+R | -R] [+A | -A] [+S | -S] [+H | -H]
										[drive:][path][filename]Where 
 Example To archive a file  | 
| cdChanges the current directory. | cd [directory]Example To change to the Chocolate directory:  | 
| certimportImports a user-specified certificate of X.509 type, which could be either DER or Base64 encoded. | certimport -cert "filepath" -stype
										"storagetype" -storage
										"Storage"Where: 
 Example To import a certificate test.cer into current user storage of "MY" type: Example To import a certificate test.cer into root user storage of the local machine:  | 
| clsClears the device screen. | cls | 
| copyCopies one or more files to another location. On Windows Mobile/CE and Desktop Classic devices, you can copy files between desktop computers and mobile devices. On Android devices, you can only copy files locally. | copy source
									destinationExample To copy all files with the extension .txt from the C:\ to the temp directory on the device:  | 
| delDeletes one or more files. | del filenameExample To delete example.txt in the current directory: Example To delete all files with the extension .tmp in the current directory and its subfolders:  | 
| dirDisplays a list of files and subdirectories in a directory. | dir
										[drive:][path][directoryName]Example To list the files in the Temp directory of the device:  | 
| echoDisplays messages or switches command echoing on or off. | echo [on | off]orecho
										messageExample To turn command echoing off: Example To turn command echoing on: Example To display the message "Copying Files ...":  | 
| exitCloses the remote help desk application window. | exit | 
| findFinds a file on the device. | find [/S] [filename]Where  Example To search for all files with a .txt file extension including subfolders: find /S *.txt | 
| finishpkgTerminates the current script without processing the remainder of the package and reports the package installation as successful to the deployment server. This is particularly useful for packages involving a cold boot or device wipe, as it prevents unnecessary re-installation. If the post-install script triggers a hard reset, the package reinstalls after the reset. To prevent this, add a check in the pre-install script to determine if the package’s files are already installed. Note: This command is not useful as a script
									command in and of itself but is useful in the event of a package
									involving a cold boot. | "path\to\package "finishpkgExample: 
 For platforms that support the
										 Example If a package's post-install script contains: 
 then the pre-install script could contain a check to prevent the package from reinstalling endlessly:  | 
| gotoDirects script execution to a labelled line in a script. Only use this command in scripts. | goto labelExample To go to label ":end":  | 
| helpor?Displays a list of the commands supported and a brief description of each command. | help | 
| ifPerforms conditional actions when meeting the specified conditions. See The if Command. | |
| ipoctetReturns the specified octet of an IP address and saves it to an environment variable, when called from within a SOTI MobiControl device script. | ipoctet IPAddress
									octetNumberExample To save the value of the fourth octet of an IP address to the environment variable myOctet: This givesmyOctetthe value 225Example To save the value of the first octet of the device's IP address to an environment variable in a device script: This givesmyOctetthe value 192 if the IP
									address is of the form 192.XXX.XXX.XXX | 
| killTerminates a process that is currently running on the device. | kill executableExample To terminate the pword.exe process on the device:  | 
| lockdeviceActivates the lock screen on a device for a specified number of minutes. Note: Minimum time is one minute. | lockdevice minutesExample To lock a device for one minute  | 
| logSends a custom message to the SOTI MobiControl deployment server from the device. This message appears in the Logs tab of the Device Information panel in the SOTI MobiControl console. | log type
									messageWhere  
 Example To send a notification to the SOTI MobiControl console at certain intervals during a software push: Note: Put the command in the pre-install script. | 
| mkdirormdCreates a new directory. | mkdir [drive:] pathExample To create a directory named "test" from the current directory: Example To create
										  | 
| moveMoves a file from a specified source location to specified destination location. Note: You can rename the file at the
									same time by specifying a name for the destination
									filename. | move [sourceFilePath]
										filename
									destinationFilePath
										[filename]Example Example To move the file test.bat: 
 
 Example To move and rename a file at the same time: Example To move a folder to the root folder:  | 
| pausePrompts the device user and waits for their input to continue. | pauseExample To show "Press any key to continue..." on the device screen:  | 
| psLists the running processes on the device. | ps | 
| regdelkeyDeletes a key from the registry on a device. | regdelkey registryKeyExample To delete a registry key HKEY_CLASSES_ROOT\.2bp::  | 
| regdelvalDeletes a value from the registry on a device. | regdelval registryKey
									valueNameExample To delete a registry value
										  | 
| regloadImports a registration file to the registry on the device. | regload registryFilePathExample To import a registration file c:\test.reg to the device's registry:  | 
| regsaveExports the device registry subtree to a specified file. | regsave [-A | -U] [drive:]
										[path] filename subtree
										[regpath]Where: 
 Example To export the
										  | 
| regsetAdds a key or a value to the device registry. | regset registryKey
										[valueName]
									[data]Example To add a new key and two values to that
									key:  | 
| remInserts a comment line in a script/batch file. | rem [comment]Example To add a comment about pumpkins:  | 
| renameRenames a file or folder. | rename sourceFilename
									destinationFilenameExample To rename the file   | 
| replacetxtChanges all occurrences of a particular character or string in the specified file to a new character or string. | replacetxt filename
									string/characterToReplace
									newString/CharacterExample To replace the "Device" string with the "Psion"
									string in the file   | 
| resetPerforms a soft or hard reset of the device. | reset [/s | /H | /W | /E]
									[/delaysec]Where: 
 On Android Plus devices, it is possible to specify a
										 If  Example To soft reset a device: Example To reset an Android Plus device to its factory settings in 30 seconds:  | 
| rmdirorrdDeletes a directory. | rmdir [/S] pathWhere  This command requires the /S option on Android Plus and Linux devices and deletes the specified item, whether a directory or a file. Example To remove an empty directory named "test" from the current directory: Example To remove a directory named "test" and all of
									its contents from the current
									directory: Example To remove a location:  | 
| setSets, edits or shows values of environment variables. | set [environmentVariable] [=|++|--]
										[string]Where: 
 You can also use  
 Example To display all environment variables: Example To set the value of the environment variable
										 Example To set the value of environment variable
										  | 
| shellexecuteLaunches the registered application for the given file extension. | shellexecute filepath -verb
										[-wseconds]Where: 
 Example To launch the registered application for the given file extension:  | 
| showmessageboxDisplays a message box on the device screen. Note: The Android
									Plus SOTI MobiControlDevice Agent has the
									following limitations:  
 | showmessagebox message
										[timer] [type]
										[default button]
										[action]Where: 
 A global variable stores the return values for the
											 Example To show a simple message: Example To enter device information using a macro: Example To set a 3-second timer to your message: Example To add YES and NO buttons to your message box with no timer: Example To enter follow-up actions to a user's response to a message box:  | 
| sleepInitiates sleep mode on the device for a set period. Only use this command in scripts. | sleep [length]Where length is in seconds. Example To set the device to sleep for 5 seconds:  | 
| sleepexInitiates sleep mode on the device for a set period. Only use this command in scripts. | sleep [length]Where length is in milliseconds. Example To set the device to sleep for 3.5 seconds:  | 
| startStarts a program on the device. When you specify the
										 | start [/wait] programNote: On Windows devices, you must enclose
										program in quotation
										marks. Example To start Pocket Word and wait until it is terminated:  | 
| turnoffTurns off the device. Note:  This script
									works only for Lenovo managed devices with an activated
									license. | turnoff [delay]Where  Example To turn off the device: Example To turn off the device in 25 seconds:  | 
| typeDisplays the contents of a Unicode text file. | type filenameExample To display the contents of the file test.cmd:  | 
| writeprivateprofstringSaves or deletes specified settings on a device. | See The writeprivateprofstring and writesecuresetting Commands for more information. | 
| writeprofstringWrites a string into the specified section of an initialization file. | writeprofstring filename section [key]
										[value]Where: 
 Use quotations (" ") if either the key or the value contains spaces. Example To set the Color key in the "Video"
									section of the   |