-
run dos command from html page
what does the /c DIR represent in the code below
i know what the %comspec% is but not the rest
what i need to do is run a python file from an HTML page
for a demonstration for collage
Run a DOS Command From an HTML Page
This is achieved by using the Windows Script Host. First, create an instance
of the object WScript.Shell. Then, use its Run method to execute the DOS
command. For example, say your HTML page has a button that will run the DIR
command when clicked. The onclick jscript function would look something like
this:
-------------------------
function btnDIR_onclick()
{
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("%comspec% /c DIR");
WshShell.Quit;
}
----------------------------
The %comspec% string in the argument for Run() specifies the path and file
name of the command interpreter, Cmd.exe.
-
Re: run dos command from html page
Is just the /c (command) switch for the command.com (default value for
%comspec%) or DOS shell translator, /c allows to run a command with the
translator without opening a new shell session, sorta like you'd in
Unix/Linux, you specify the shell to use for the commands, so you can run C
shell commands in a Bash session and so on.
Dan
"steve hamilton" <stevehamilton@blueyonder.co.uk> wrote in message
news:3cc03656$1@10.1.10.29...
>
> what does the /c DIR represent in the code below
> i know what the %comspec% is but not the rest
> what i need to do is run a python file from an HTML page
> for a demonstration for collage
>
> Run a DOS Command From an HTML Page
> This is achieved by using the Windows Script Host. First, create an
instance
> of the object WScript.Shell. Then, use its Run method to execute the DOS
> command. For example, say your HTML page has a button that will run the
DIR
> command when clicked. The onclick jscript function would look something
like
> this:
> -------------------------
> function btnDIR_onclick()
> {
> var WshShell = new ActiveXObject("WScript.Shell");
> WshShell.Run("%comspec% /c DIR");
> WshShell.Quit;
> }
> ----------------------------
> The %comspec% string in the argument for Run() specifies the path and file
> name of the command interpreter, Cmd.exe.
>
>
-
Re: run dos command from html page
Steve,
/c for "carries out the command specified by the string and then terminates"
you might want to know more command line parameter for cmd.exe
simply go to the command prompt and then type "cmd /?".
have fun
ynwt
====
"steve hamilton" <stevehamilton@blueyonder.co.uk> wrote:
>
>what does the /c DIR represent in the code below
>i know what the %comspec% is but not the rest
>what i need to do is run a python file from an HTML page
>for a demonstration for collage
>
>Run a DOS Command From an HTML Page
>This is achieved by using the Windows Script Host. First, create an instance
>of the object WScript.Shell. Then, use its Run method to execute the DOS
>command. For example, say your HTML page has a button that will run the
DIR
>command when clicked. The onclick jscript function would look something
like
>this:
>-------------------------
>function btnDIR_onclick()
>{
> var WshShell = new ActiveXObject("WScript.Shell");
> WshShell.Run("%comspec% /c DIR");
> WshShell.Quit;
>}
>----------------------------
>The %comspec% string in the argument for Run() specifies the path and file
>name of the command interpreter, Cmd.exe.
>
>
-
Re: run dos command from html page
"steve hamilton" <stevehamilton@blueyonder.co.uk> wrote:
>
>what does the /c DIR represent in the code below
>i know what the %comspec% is but not the rest
>what i need to do is run a python file from an HTML page
>for a demonstration for collage
>
>Run a DOS Command From an HTML Page
>This is achieved by using the Windows Script Host. First, create an instance
>of the object WScript.Shell. Then, use its Run method to execute the DOS
>command. For example, say your HTML page has a button that will run the
DIR
>command when clicked. The onclick jscript function would look something
like
>this:
>-------------------------
>function btnDIR_onclick()
>{
> var WshShell = new ActiveXObject("WScript.Shell");
> WshShell.Run("%comspec% /c DIR");
> WshShell.Quit;
>}
>----------------------------
>The %comspec% string in the argument for Run() specifies the path and file
>name of the command interpreter, Cmd.exe.
>
The /c is a switch for the cmd.exe program. It tells cmd to run the command
then close. DIR is of course the DOS command to list contents of a directory.
If you go to start:run then type in 'cmd.exe /c DIR' thats the basic equivalent
of what is happening above. Leave the /c off and you'll see the window does
not close. For your application, Im sure something like "%comspec% c:\paethon\nameofpaethonprogram"
would do it? I have no idea how to run paethon from a command line...and
Im no expert 
Ryan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|