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 |
---|---|
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, this command 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:
|
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:
|
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
Terminates 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 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 when meeting the specified conditions. See The if Command. |
|
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 lock screen on a device for a 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 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 To move the file test.bat:
To move and rename a file at the same time:
To move a folder to the root folder:
|
pause
Prompts the device user and waits for their 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 the registry on a device. |
regdelkey registryKey
Example To delete a registry key
|
regdelval
Deletes a value from the registry on a device. |
regdelval registryKey
valueName
Example To delete a registry value
|
regload
Imports a registration file to the registry on the device. |
regload registryFilePath
Example To import a 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 the device registry. |
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 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:
To remove a directory named "test" and all of its contents from the current directory:
To remove a 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 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:
To enter 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 enter 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:
|
start
Starts a program on the device. When you specify the
|
start [/wait] program
Note: On Windows devices, you must enclose
program in quotation
marks. Example To start Pocket Word and wait until it is terminated:
|
turnoff
Turns 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:
To turn off the device in 25 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 and writesecuresetting Commands 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
|