PRODUCT






Home









Free Download








Installation Instructions





FAQ





FAQ








Ask A Question





LEARN SCRIPTING





Overview








Lesson 1








2


3


4


5








Exam





SAMPLE SCRIPTS





Computer








Internet








Administrators








Developers








Data








Miscellaneous





HELP / DOCUMENTATION





Commands








Automated Internet








Automated Editors








Sample Scripts








Precompiled Functions








System Features






  Help Page - system

( Some help pages may not display correctly in html because those help pages may have sample code
in them, part of which may be mis-interpreted as html tags.

All help pages, including this help page, are available in biterScripting with the help command. )




Command system Purpose Sends a command or an executable to the operating system for execution. Aliases system, sys Syntax system <command> [ <argument> [ <argument> ... ] ] Options -s Leave forward slashes alone (as forward slashes). Without this option, all forward slashes in the system command are translated to back slashes. (This is done because many operating systems recognize only back slashes in file and directory paths.) Arguments <command> This is a command or an executable that will be executed by the operating system. This can be relative path name, or absolute path name. It can be an executable that you have created, a program from a third party or a command that you can execute on the operating system's command console. It can be specified using a constant, variable, expression, function call, inline command, or a combination of these, all resulting in a value of type str. <argument> This is an argument that will be sent to the <command> as a command-line argument. This can be any string whose interpretation is left to the <command>. It can be an option such as -x, an argument such as "abc" or an option with an argument such as "-x abc". If the <argument> needs a double quote within it, it can be included by backspacing it. <argument> can be specified using a constant, variable, expression, function call, inline command, or a combination of these, all resulting in a value of type str. Stream Input Contents of stream input are passed as stream input to the <command>. Stream Output The stream output from the <command> is added to the system command's own stream output. Stream Error Any errors are listed here. Also, stream error from the <command> is added to the system command's own stream error. Description This command is used to send a command or an executable to the operating system for execution. <command> and <argument>s together need to result in a string that you can type directly on the operating system's command console. The stream input to the system command is passed as stream input to <command>. biterScripting will wait till <command>'s execution is completed. Upon completion of its execution, the stream output and stream error produced by the <command> are added to the system command's own stream output and stream error respectively. These are then processed according to any redirection you may have specified. Restrictions Some operating systems require that all path names be specified with backslashes, such as C:\Temp. Sending commands to these operating systems will require changing all forward slashes to backslashes in any path names in arguments. A sample script SS_SlashBack is available to do just that. See in valid examples below for how to use this script. biterScripting itself will handle path names with forward slashes or backslashes correctly. For example, biterScripting will correctly interpret all of the following - C:/Temp, C:\Temp, C:\\Temp . Valid Examples system "copy x.doc y.doc" Will copy file x.doc to file y.doc. This will work on operating systems that support the copy command. var str fileList, file lf -rn "*" "C:/mypages" ($fatime < "20050101") > $fileList while ($fileList<>"") do lex "1" $fileList > $file script SS_SlashBack.txt ospath($file) > $file system del $file done Will delete all files in directory C:/mypages (and subdirectories) that have not been accessed since Jan 1, 2005 (20050101). system "C:/program.exe" >"C:/out.txt" 2>"C:/err.txt" Assuming that you have developed a program and stored it in "C:/program.exe", the above command will execute it and write the data from its stream output and stream error to files C:/out.txt and C:/err.txt respectively. Invalid Examples system "script1.txt" Assuming that script1.txt contains a valid biterScripting script, the above is erroneous. If the intent is to execute a biterScripting script, use the following instead. script "script1.txt" Some operating systems have difficulty in dealing with spaces and other special characters in file and directory names. Here is an example. system rename "X Y.txt" "XY.txt" The above will probably produce an error from the operating system because it may not be able to handle the file name "X Y.txt" correctly. To alleviate that, enclose the file name within the double quotes and wrap the entire string into an expression, as follows. system rename ("\""+"X Y.txt"+"\"") "XY.txt" This approach will work with variables also. For example, if the name of the file was passed thru a str variable $file, and we are looking to rename it to "XY.txt", the following will work. system rename ("\""+$file+"\"") "XY.txt" See Also batch script var constant inline

2008-2013, biterScripting.com. All rights reserved.
biterScripting, biterScript, biterBrowser, biterMobile, biterScripting.com, FVA (Forward Variable Assignment) are trademarks of biterScripting.com. Is it biterScripting-compatible ? is a service mark of biterScripting.com. Explorer, Unix, Windows are trademarks, service marks or other forms of intellectual property of their respective owners.