[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Win32 - how do I execute a shell command?

From: Mathias Dahl
Subject: Re: Win32 - how do I execute a shell command?
Date: 30 Jul 2004 09:15:11 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Paul Moore <address@hidden> writes:

> I have a Python script I want to execute and obtaing the stdout. In
> XEmacs, I can do so simply using
>     (shell-command-to-string (expand-file-name "~/"))
> This doesn't work in Gnu Emacs, basically because expand-file-name
> returns filenames with *forward* slashes, which the shell doesn't
> like.
> OK, I could do a global replace of / with \, but that seems like a
> hack. Is there a "expand file name in Win32 native format" (ie, with
> backslashes) function?

I have found no such function so I use this:

 (defun slash-to-backslash (text)
   (substitute ?\\ ?/ text))

Also, as Jason tells you, you should either use cmd.exe's
start command, if the .py files is associated with the
correct program, or explicitly start it with the correct

Something like this should work (not tested);

  (concat "python " (slash-to-backslash (expand-file-name "~/"))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]