Script Commands for Windows Desktop Classic Devices
Use the options and examples below to help you create your own powerful script commands.
Legend
| Format | Meaning | 
|---|---|
| text | Enter the command exactly as shown. | 
| text | Replace with the requested information. | 
| [text] | Information contained within square brackets is optional to 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, it stops the file synchronization process. See Using File Sync Rules 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: 
 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, files can be copied between desktop computers and mobile devices. On Android devices, files can only be copied locally. | copy source destinationExample To copy all files with the extension .txt from the C:\ to the temp directory on the device: C:\tempt\*.txt 1:\temp | 
| delDeletes one or more files. | del filenameExample To delete example.txt in the current directory: 
 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: 
 To turn command echoing on: 
 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: 
 | 
| finishpkgFinishes the current script without processing the rest of the package and reports package installation as successful to the deployment server. This is useful particularly in packages that involve wiping a device. This script command can be used to skip reinstalling the package but still report back as successfully installed to the deployment server. If a hard reset is initiated from a package's post-install script, the entire package will reinstall after the reset. A check can be included in the pre-install script that determines whether the package's files have already been installed. Note: This command is not useful as a script command in and of itself but in the event of a package that involves a cold boot. | "path\to\package"finishpkgExample 
 For platforms that support the  
 then the pre-install script could contain a check to prevent the package from being reinstalled 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 if the specified conditions are found. See The if Command for more information | |
| 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: 
 To save the value of the first octet of the device's IP address to an environment variable in a device script: 
 | 
| killTerminates a process that is currently running on the device. | kill executableExample To terminate the pword.exe process on the device: 
 | 
| lockdeviceActivates the lockscreen on a device for the specified number of minutes. Note: Minimum time is one minute. | lockdevice minutesExample To lock a device for 1 minute 
 | 
| logSends a customs 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: 
 To create  
 | 
| moveMoves a file from 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 To move the file test.bat: 
 
 To move and rename a file at the same time: 
 To move folder to root folder: 
 | 
| pausePrompts device user and waits for user 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 registry on a device. | regdelkey registryKeyExample To delete registry key  
 | 
| regdelvalDeletes a value from the registry on a device. | regdelval registryKey valueNameExample To delete registry value  
 | 
| regloadImports a registration file to the registry on the device. | regload registryFilePathExample To import 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 registry on the device. | 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  
 | 
| replacetextChanges all occurrences of a particular character or string in the specified file to a new character or string. | replacetext filename string/characterToReplace newString/CharacterExample To remove the string "Device Psion" from 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: 
 To reset an Android Plus device to its factory settings in 30 seconds: 
 | 
| rmdirorrdDeletes a directory. | rmdir [/S] pathWhere  On Android Plus and Linux devices, this command requires the  Example To remove an empty directory named "test" from the current directory: 
 To remove a directory named "test" and all of its contents from the current directory: 
 To provide location: 
 | 
| setSets, edits or shows values of environment variables. | set [environmentVariable] [=|++|--] [string]Where 
 You can also use  
 Example To display all environment variables: 
 To set the value of the environment variable  
 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 agent has the following limitations:
									 
 | showmessagebox message [timer] [type] [default button] [action]Where 
 The return values for the  Example To show a simple message: 
 To provide device information using a macro: 
 To set a 3 second timer to your message: 
 To add YES and NO buttons to your message box with no timer 
 To provide followup actions to a user response to 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 the  | start [/wait] programNote: On Windows devices, program must be enclosed in quotation marks. Example To start Pocket Word and wait until it is terminated: 
 | 
| turnoffShuts down the device. You can specify a delay (in milliseconds) before shutdown. | turnoff [time]Example To turn off the device in 3.5 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 Command 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  
 |