Script Commands for macOS Devices

Use the options and examples below to help you create your own powerful script commands.

Note: Not all script commands are compatible with all devices within a platform. Limitations are noted in the table entries.
Note: Use the commands and scripts as supported for the macOS distribution on the device. For details, read Sending Scripts to Devices.

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
cd

Changes the current directory.

cd [directory]

Example

To change to the Chocolate directory:

cd Chocolate

copy

Copies 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 destination

Example

To copy all files with the extension .txt from the C:\ to the temp directory on the device:

C:\tempt\*.txt 1:\temp

del

Deletes one or more files.

del filename

Example

To delete example.txt in the current directory:

del example.txt

To delete all files with the extension .tmp in the current directory and its subfolders:

del *.tmp

install

Installs an application on the device.

install appInstallerPath

Where appInstallerPath is the full path to the application installation file on the device

Example

To install the Team Viewer app whose installer is located on the desktop:

install "users/jsmith/Desktop/Team Viewer.pkg"

kill

Terminates a process that is currently running on the device.

kill executable

Example

To terminate the pword.exe process on the device:

kill pword.exe

log

Sends 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 message

Where type is the type of the associated message and the options are:

  • -e for Error
  • -w for Warning
  • -i for Information

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

log -i "Starting Software Push"

mkdir or md

Creates a new directory.

mkdir [drive:] path

Example

To create a directory named "test" from the current directory:

mkdir test

To create test\test1\test2\test3 recursively:

mkdir test \test1 \test2 \test3

move

Moves 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:

move test.bat 2:\

move test.bat 2:\test.bat

To move and rename a file at the same time:

move 1:\test.bat 2:\test2.cmd

To move folder to root folder:

move Mars /

rename

Renames a file or folder.

rename sourceFilename destinationFilename

Example

To rename the file test.txt to test.bak:

rename test.txt test.bak

reset

Performs a soft or hard reset of the device.

reset [/S] [/delaymin]

Where

  • /S soft resets the device. Any desktop remote control sessions will also be terminated.
  • /delay specifies a delay (in minutes) before executing the reset. If no delay is set, reset occurs immediately.

Example

To soft reset a device in 3 minutes:

reset /S 3

rmdir or rd

Deletes a directory.

rmdir [/S] path

Where /S removes any subdirectories

On Android Plus and Linux devices, this command requires the /S option and will delete the specified item whether it is a directory or a file.

Example

To remove an empty directory named "test" from the current directory:

rmdir test

To remove a directory named "test" and all of its contents from the current directory:

rmdir /S test

To provide location:

rmdir /sdcard/Download/test

setdate

Sets the date and time.

setdate date [time]

Where date is in the following format: mm-dd-yyy and time is in the following format: HH:MM:SS

Example

To set the date and time of the device

setdate 08-20-2016 13:32:00

shellexecute

Launches the registered application for the given file extension.

shellexecute filepath -verb

Where

  • -verb is the action you want the shell to execute

Example

To launch the registered application for the given file extension:

shellexecute 1:\temp\temp.upg -open

showmessagebox

Displays a message box on the device screen.

showmessagebox message [timer] [type] [NOTIFY_DEVICE]

Where

  • message is the message displayed in the message box. Use quotation marks (" ") if there are spaces in the message.
  • timer is the number of seconds until the message box disappears automatically. If you omit a timer value or add the keyword NO_TIMER, the message box will persist until the device user dismisses it.
  • type is type of of message box. Options are:
    • 1 displays an information window with an OK button
    • 2 displays a question window with Yes and No buttons
    • 3 displays a warning window with an OK button
    • 4 displays a question window with OK and Cancel buttons
    • 5 displays an error window with an OK button

Example

To show a simple message:

showmessagebox "This is a test message"

To provide device information using a macro:

showmessagebox "Your device's IP address is %IP%"

To set a 3 second timer to your message:

showmessagebox "This is a test message with a 3 second timer" 3

To add YES and NO buttons to your message box with no timer

showmessagebox "This is a test message with Yes/No button and no timer" NO_TIMER 2

sleep

Initiates 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:

sleep 5

SYSTEM_SCRIPT_BLOCK

Allows for multi-line macOS scripts by informing the device agent where a script starts.

<SYSTEM_SCRIPT_BLOCK>
/SYSTEM_SCRIPT_BLOCK

Allows for multi-line macOS scripts by informing the device agent where a script ends.

</SYSTEM_SCRIPT_BLOCK>
writeprivateprofstring

Saves or deletes specified settings on a device.

See The writeprivateprofstring Command for more information.