WMIC:如何使用具有特定工作目录的**进程调用create **?

任务是使用wmic process call create "c:\folder\app.exe"来启动一个程序,让app.exeapp.exe home folder tree访问它自己的支持文件。

下面的批处理脚本说明了WMIC静静地更改工作目录的问题,因此无法find支持文件。

该脚本创build第二个称为one.batbatch file,只需从同一文件夹中键入一个url.txt文件,即可在控制台上显示www.google.com

当使用wmic创build进程时,wmic默默地改变工作目录,以便one.bat ,如果我将完整path指定为d:\abc\one.bat one.bat则会启动one.bat但无法find在它自己的文件夹中input名为url.txt的文件。

如果我将WMIC.EXE文件复制到相同的文件夹,它以相同的方式失败。

 @echo off set "folder=d:\abc" cd /d "%folder%" ( echo.@echo off echo.type url.txt echo.pause )>one.bat ( echo.@echo off echo.www.google.com )>url.txt echo this will work to launch the one.bat but the working directory is wrong and the file can't be found wmic process call create "%folder%\one.bat" pause echo this will not launch one.bat because it can't be found wmic process call create one.bat pause echo this will not launch one.bat as the working directory is changed copy "%windir%\system32\wbem\wmic.exe" . .\wmic process call create one.bat pause 

有谁知道一个WMIC开关,将设置此命令的工作目录?

Solutions Collecting From Web of "WMIC:如何使用具有特定工作目录的**进程调用create **?"