Executing windows commands in tcl


















The exec command allows you to execute another program, and optionally capture any output generated by it: exec command? See the reference page for a complete list. For example, the following command executes the Unix ls command and writes the output to the file ls-output.

For example, we could capture the output of ls and store it in a variable as follows: set result [exec ls -l] Of course, you should always use the built-in Tcl command glob for getting directory listings, rather than calling out to OS programs like ls or dir. It's faster and platform independent. With program pipelines, it's the output of the last program in the pipeline that becomes the return value of exec. That can be a problem sometimes, with programs that take a while to run.

And if a program never returns, your script never regains control. You can get around this limitation somewhat by running a program in the background. The drawback is that your script doesn't get the output generated by the command. If you don't redirect the output to a file or another program, it's discarded. As you can see, exec is a reasonable tool for executing short-duration programs and capturing their output, or as a simple program launcher.

But it isn't appropriate for long-running programs, or programs with which you want your script to interact send messages and read responses interactively. In these cases, you need Tcl's more sophisticated interprocess communication tools: interprocess pipes and sockets. If you're interested in these, we can continue this in another message. Good Luck. Red Flag This Post Please let us know here why this post is inappropriate. Close Box.

Log In Come Join Us! Posting Guidelines Promoting, selling, recruiting, coursework and thesis posting is forbidden. How to execute shell command in tcl? The next words represent the arguments. As said before, we have used "" to group two words. Here, stdout makes the program to print in the standard output device. In command substitutions, square brackets are used to evaluate the scripts inside the square brackets.

Copies a saved list to either a new item-ID, a new file reference, or to the specified output device. Sets aside a contiguous set of frames as the destination for loading the ABS code the D3 virtual code. Creates a new master dictionary, copies all the necessary items into it, and updates the mds file with the name and address. Creates a new dictionary and data file, a dictionary-only file, or a new data section on an existing dictionary file; space is allocated and reserved if available.

Creates a new B-tree index in the specified file using the a algebraic processing code expression provided and ensures the a0 index case-sensitivity matches the item-ID case sensitivity. Creates an executable macro from the last TCL command entered and places the macro in the master dictionary of the current account.

Builds a Q-pointer for each D-pointer file in the dm account and adds them to the dm,newac, file. Invokes the copy command and copies the specified items to the terminal. Copies a tape to another tape, including format and block conversions, and reads D3, CIE, Reality or Ultimate tape formats, with a block size up to 64 KB, and creates a D3 tape. Returns an internal, external, or Julian date derived from a date provided, or displays a calendar for the month and year of the date provided.

Removes the compiled BASIC or FlashBASIC object code of the specified items from the dictionary of the specified file, and removes the corresponding command entry or entries from the master dictionary of the current account. Displays the available terminal driver definitions and allows changing existing definitions or adding new ones. Deletes an entire account, and all the associated files, returning the space used to the overflow table and removing the account name from the mds file.

Releases all frames used by the specified file to the overflow table, and removes the file reference from the master dictionary of the current account. Removes either a specific B-tree index from a specified file, or all indexes if an asterisk is specified. Removes a list previously saved with a save-list command. Removes the flash-compiled object code from the object code item, leaving the non-flash object code.

Controls the dialer subsystem, which allows transferring data to remote systems over the phone in a batch mode. Divides the first integer number provided by the second integer number provided and displays the result as an integer quotient and remainder. Issues an exec abs command each time a user logs on to the dm account. Invokes the line editor for entry or update of any item in the system that is, BASIC programs, Procs, data items, and so on.

Retrieves a previously saved list and enters the line editor same as ed or edit. Terminates a process on another port, or the current port if a port number is not specified. Displays information about the state of the local transaction logging disabled flag for either a specified line or all lines currently logged on. Specifies that the code generated by pressing ESC control [ is to be passed through as data. Turns the function of the ESC key to either be treated as data esc-data or as a level-pushing mechanism esc-level.

Examines existing file modulos VME only for every file found in the file-of-files file, and recalculates a new recommended modulo for each file.

Prints out the n th word in a list of words. Provides utilities for managing file update and retrieval locks on groups of files and users. Searches a file for the existence of one or more strings of characters in any attribute and optionally creates and saves a list.

Invokes the search-system command. Creates a new flush process when available buffers go below the percentage specified in criteria for the amount of time specified in interval. Restores a specially formatted account-save created by certain utility programs. Activates an item-list from the pointer-file file. The default file is the pointer-file file. Returns a string representing whether or not the Windows Authentication logon mode is enabled. Forces the system to not attempt to push a level or go into the debugger when any character is input.

Initiates the D3 overflow initialization, and is invoked as a phantom by the initovf command. Assigns all ports a terminal type by updating attribute 2 in the pibs file. Checks the overflow table to determine if it has previously been scrubbed and invokes the init-ovf command, if necessary. Selects all of the item-IDs in the group that the specified item-ID hashes to, using the item command.

Selects and sorts all of the item-IDs in the group that the specified item-ID hashes to, using the item command. Outputs the base FID of the group to which the specified item-ID hashes, and a list of all item-IDs that are currently hashed to the same group.

Lists the summary description attribute 17 of each attribute-defining item in the specified file. Outputs a legend on the bottom of each page of a printed reports directed to the spooler, unless the legend suppress modifier leg-supp is in effect. Performs a series of reports from the dm,errors, file. Produces a sorted listing of all file-defining items in the specified file, along with the description attribute from each file pointer.

Contains the AQL sentence which uses the dm,file-of-files file. Same as the lfsi macro except that the i-fms column becomes index-fms. Same as the lfs macro except that the bytes column becomes i-bytes and the frames column becomes i-fms. Creates a logical link between the given or current process and the specified port number.

Produces a report of each D3 mode in the dm,abs, file, showing any modes it calls and those modes which are called. Produces a sorted report of the error messages logged into the dm,errors, file, beginning with the most recently logged message. Produces the file statistics report generated from the most recently executed file-save Command or account-save Command.

Produces a report of all file-defining items D-pointers and synonym-defining items Q-pointers. Produces a report indicating the status of all phantom controlled processes currently in the dm,jobs, file. Displays communications protocol information for every port attached to the virtual machine.

Produces a sorted report of all previously saved lists in the pointer-file file. Lists the VME processes that are enqueue waiting to lock a frame, that is currently locked by some other process.

Produces a report showing the history of logoffs recorded in the dm,errors, file, along with who logged off and the status of the logged off port. Produces a sorted report of all items defined as macros in the specified account name or your local MD if md is specified. Lists the status of files currently being resized from the dm,resizing file. Produces a sorted report of error conditions logged into the dm,runtime-errors, file. This last one is very useful when you need to do complex redirections; they're currently easier to do in the Bourne shell and its derivatives than in Tcl.

It probably won't work on Windows though; the equivalent with firing stuff through CMD. EXE is unfortunately a bit horrible.

Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 8 years, 5 months ago. Active 8 years, 5 months ago. Viewed 2k times.



0コメント

  • 1000 / 1000