Script Commands for Windows Mobile Devices
Use the options and examples below to help you create 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 |
---|---|
abortpkg
Halts 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 |
abortsync
When used in a SOTI MobiControl pre-sync script, it stops the file synchronization process. See Using File Sync Policies for more information. |
abortsync
Example 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):
|
attrib
Displays or changes file attributes. |
attrib [+R | -R] [+A | -A] [+S | -S] [+H | -H]
[drive:][path][filename]
Where
Example To archive a file:
|
cd
Changes the current directory. |
cd [directory]
Example To change to the Chocolate directory:
|
certdelete
Deletes a certificate on the device. |
certdelete -issuer "IssuerName" -sn
"SerialNumber" -storage
"storage"
Where:
Example To delete a certificate issued by apache.org:
|
certimport
Imports 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:
|
cls
Clears the device screen. |
cls |
copy
Copies 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
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:
To delete all files with the extension .tmp in the current directory and its subfolders:
|
dir
Displays 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:
|
echo
Displays messages or switches command echoing on or off. |
echo [on | off] or echo
message
Example To turn command echoing off:
To turn command echoing on:
To display the message "Copying Files ...":
|
exit
Closes the remote help desk application window. |
exit |
find
Finds a file on the device. |
find [/S] [filename]
Where Example To search for all files with a .txt file extension including subfolders:
|
finishpkg
Finishes 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. Use this script command to skip reinstalling the package but still report as successfully installed to the deployment server. If a hard reset is initiated from a package's post-install script, the entire package reinstalls after the reset. Include a check in the pre-install script to determine whether the package's files are already installed. Note: This command is not useful as a
script command in and of itself but in the event of a package
involving a cold boot.
|
"path\to\package"finishpkg
Example
For platforms that support the
then the pre-install script could contain a check to prevent the package from reinstalling endlessly:
|
goto
Directs script execution to a labelled line in a script. Only use this command in scripts. |
goto label
Example To go to label ":end"
|
help or ?
Displays a list of the commands supported and a brief description of each command. |
help |
if
Performs conditional actions if the specified conditions are found. See The if Command for more information |
|
install
Installs an application on the device. |
install appInstallerPath
Where appInstallerPath is the full path to the application installer file on the device Example To install the Gmail app located on an SD card:
|
ipoctet
Returns 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
octetNumber
Example 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:
|
itcssconfig
Loads the specified XML configuration file to the operating system. You must provide the complete path to the XML file. Note: This command is applicable only to Intermec
devices with Intermec SmartSystems. This command takes the supplied XML file containing the SmartSystems request and in return, creates an output file in the same directory with *.out.* inserted before the extension. The command passes the XML file to SmartSystems API without modification, so it accepts any valid request (either "Get" or "Set"). It is possible to use XML files generated with SmartSystems Console. See Advanced Intermec SmartSystems Settings: XML Scripting for more information. |
itcssconfig *.xml
To generate an XML script that enables "Code 39" decoding in all devices in the Scanners group:
|
kill
Terminates a process that is currently running on the device. |
kill executable
Example To terminate the pword.exe process on the device:
|
lockdevice
Activates the lockscreen on a device for the specified number of minutes. Note: Minimum time is one minute.
|
lockdevice minutes
Example To lock a device for 1 minute
|
log
Sends 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
message
Where
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
|
mkdir or md
Creates a new directory. |
mkdir [drive:] path
Example To create a directory named "test" from the current directory:
To create
|
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:
To move and rename a file at the same time:
To move folder to root folder:
|
pause
Prompts device user and waits for user input to continue. |
pause
Example To show "Press any key to continue..." on the device screen:
|
ps
Lists the running processes on the device. |
ps |
regdelkey
Deletes a key from registry on a device. |
regdelkey registryKey
Example To delete registry key
|
regdelval
Deletes a value from the registry on a device. |
regdelval registryKey
valueName
Example To delete registry value
|
registerdll
Registers or unregisters a DLL on the device. |
registerdll [-U] dllFilename
Where -U is included when you want to unregister a dll Example To register a dll:
To unregister a dll:
|
regload
Imports a registration file to the registry on the device. |
regload registryFilePath
Example To import registration file c:\test.reg to the device's registry:
|
regsave
Exports the device registry subtree to a specified file. |
regsave [-A | -U] [drive:]
[path] filename subtree
[regpath]
Where:
Example To export the
|
regset
Adds 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:
|
rem
Inserts a comment line in a script/batch file. |
rem [comment]
Example To add a comment about pumpkins:
|
rename
Renames a file or folder. |
rename sourceFilename
destinationFilename
Example To rename the file
|
replacetxt
Changes all occurrences of a particular character or string in the specified file to a new character or string. |
replacetxt filename
string/characterToReplace
newString/Character
Example To replace the "Device" string with the
"Psion" string in the file
|
reset
Performs 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:
|
resetpassword
Resets device password to a new password. |
resetpassword
newPassword
Example To reset the current password to password12345
|
rmdir or rd
Deletes a directory. |
rmdir [/S] path
Where 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:
|
sendsms
Sends an outbound SMS (text message) from any online or ActiveSync enabled device to one or more devices. The device receiving the SMS must have SOTI MobiControl installed for the command to complete successfully. |
sendsms
recipientPhoneNumber;recipientPhoneNumber
"message"
Separate phone numbers with a semicolon. Example To send an SMS message to multiple numbers:
|
set
Sets, 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
|
setdate
Sets the date and time. |
setdate date [time]
Where Example To set the date and time of the device
|
shellexecute
Launches the registered application for the given file extension. |
shellexecute filepath -verb
[-wseconds]
Where:
Example To launch the registered application for the given file extension:
|
showmessagebox
Displays 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 follow-up actions to a user's response to a message box:
|
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:
|
sleepex
Initiates 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:
|
smsreportpn
Sends a hidden encoded SMS message to a device to store its current phone number in the registry. Some SIM cards are not provisioned by the cellular carrier with their phone number post purchase. This prevents SOTI MobiControl from obtaining the devices phone number from the standard API calls.
HKLM\Software\Apps\SOTI\
with the key name There are two SMS messages, one from each device. The registry key value is set on the target device. |
smsreportpn phoneNumber
Example To set a device's phone number information:
|
start
Starts a program on the device. When the |
start [/wait] program
Note: On Windows devices, program must be
enclosed in quotation marks. Example To start Pocket Word and wait until it is terminated:
|
turnoff
Shuts down the device. You can specify a delay (in milliseconds) before shutdown. |
turnoff [time]
Example To turn off the device in 3.5 seconds:
|
type
Displays the contents of a Unicode text file. |
type filename
Example To display the contents of the file test.cmd:
|
uninstall
Removes the specified program from the device. |
uninstall [/w] program
Where:
Example To remove the program Google Maps:
|
writeprivateprofstring
Saves or deletes specified settings on a device. See The writeprivateprofstring Command for more information. |
|
writeprofstring
Writes 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
|
xmlconfig
Loads the specified XML configuration file to the operating system. This command takes the supplied XML file and loads it onto the operating system. It is only valid on devices running Pocket PC 2003 or later. The XML file is handled by Microsoft's configuration manager. Use of this command allows you to script in complicated device configuration schemas for easy deployment. |
xmlconfig filename.xml
The complete filepath for the XML file must be provided. Example To load an xml file to the operating system:
|