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 |
---|---|
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 Rules 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:
|
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, 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:
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. 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"finishpkg
Example
For platforms that support the
then the pre-install script could contain a check to prevent the package from being reinstalled 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 |
|
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:
|
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 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
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
|
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:
|
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:
|
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
|
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 followup actions to a user response to 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:
|
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:
|
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
|