简体   繁体   中英

how to run cmd in php exec function

I am trying to run a command on windows which is the follwing :

 sfm+pmvs C:\\xampp\\htdocs\\temp\\$filename/ hello.nvm

I have done this but it wont work for me :

exec("C:\\xampp\\htdocs\\temp\\draw\\VisualSFM_win32.exe sfm+pmvs C:\\xampp\\htdocs\\temp\\$filename/ hello.nvm");

when I do the following :

exec("C:\\xampp\\htdocs\\temp\\draw\\VisualSFM_win32.exe");

it works just fine but I need the other paramters to be included in the command line

how could that be done in php and is there any way to open a cmd.exe and to run the command above ?

thanks in advance

Exec() just running in cmd command which you wrote as first argument of exec(). If VisualSFM_win32.exe not support arguments by run via cmd, you cannot run it as you want. Sorry for my english =)

You asked me for exapmle. My example below. I am not sure it is 100% right because i don't use windows last 3 years.

@echo off
cd "C:\xampp\htdocs\temp\draw\"
start VisualSFM_win32.exe sfm+pmvs C:\xampp\htdocs\temp\%1/ hello.nvm

and in php

exec("C:\\test.bat " . $filename);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM