Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Calling a MS-DOS command

  • To: mathgroup at smc.vnet.net
  • Subject: [mg56896] Re: Calling a MS-DOS command
  • From: OT <montoz at iol.it>
  • Date: Mon, 9 May 2005 01:46:34 -0400 (EDT)
  • Organization: C.U. Srl Usenet Server
  • References: <d5kasq$29r$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Swati Shah ha scritto:
> Hi everyone,
> 
> I would like to call some DOS commands from Mathematica like 
> 
> delete ("tmp.txt")
> copy filea to fileb
> 
> Is this possible in Mathematica? I have been looking at the
> documentation but am not having a lot of luck.
> 
> Thanks in advance
> 

You can use the Run[] command:
Run[expr_1,expr_2,... ] generates the printed form of the expressions 
expr_i, separated by spaces, and runs it as an external, operating 
system, command.

Note that
!"command" is the same of
Run["command"]

As an example, under windows the input
!cmd
starts the MS-DOS console. In this case after the ms-dos console is 
started the front end still looks like evaluating, because it's waiting 
for the end of the external command. When you close the ms-dos console, 
mathematica will know that the execution of the external, system code is 
ended and you'll be able to do new computation in the front end.

If you evaluate
!cmd
1+1

you'll see..

bye,

OT


  • Prev by Date: Re: How to quickly find number of non-zero elements in sparse matrix rows?
  • Next by Date: Re: Calling a MS-DOS command
  • Previous by thread: Re: Calling a MS-DOS command
  • Next by thread: Re: Calling a MS-DOS command