Home > database >  '.' is not recognized as an internal or external command, operable program or batch file
'.' is not recognized as an internal or external command, operable program or batch file

Time:08-12

Trying to run a cpp program through shell, using exec command in nodejs, I wrote below exec command in node.js. (btw i am trying in windows)

exec(`g   ${fileData.filepath} -o ${outPath} && cd ${outputPath} && ./${jobId}.exe,
   (error,stdout,stderr)=>{
                if(error){
                    reject({error,stderr})
                }
                if(stderr){
                    reject(stderr)
                }
                resolve(stdout)
            })

The Program is getting stored where it was expected to get stored in .exe format. There is one error which I am getting which is '.' is not recognized as an internal or external command, operable program or batch file. Help me fix this.

CodePudding user response:

Just remove ./ from the exec command for executing the exe file, because ./ is used in linux, not in Windows ( When you are already in the directory containing the executable file ).

exec(`g   ${fileData.filepath} -o ${outPath} && cd ${outputPath} && ${jobId}.exe`,
   (error,stdout,stderr) => {...})

CodePudding user response:

For an executable you don't need to do ./ . just filename.exe should work.

  • Related