Boa tarde gente, eu gostaria de uma ajuda para converter Batch script para a linguagem C, eu até consegui um pragrama que faz isso mas ele só funciona com até 150 caracteres por causa de licença, e também consegui criar manualmente mas dá erro, Exemplo:
Código Batch convertido para C:
Apresenta o seguinte erro na hora de compilar:
Batch.c: In function `main':
Batch.c:24: error: `nNF' undeclared (first use in this function)
Batch.c:24: error: (Each undeclared identifier is reported only once
Batch.c:24: error: for each function it appears in.)
Batch.c:24: error: syntax error before '%' token
Batch.c:32:2: warning: no newline at end of file
Código Batch convertido para C:
- Código:
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
int main()
{
system("@ECHO OFF");
system("BREAK OFF");
system("");
system("TITLE Procurar XML");
system("@net use y: /delete >nul");
system("@net use y: \\servidor\nf-e >nul");
system("y:");
system("cls");
system("echo.");
system("set /P nfe=Digite o numero da NFe: ");
system("echo.");
system("echo Arquivos encontrados:");
system("findstr /S /M /C:"<nNF>%nfe%</nNF>" NFe*");
system("echo.");
system("echo Pressione qualquer tecla para SAIR.");
system("@pause >nul");
system("c:");
system("@net use y: /delete >nul");
printf("\n");
getch();
}
Apresenta o seguinte erro na hora de compilar:
Batch.c: In function `main':
Batch.c:24: error: `nNF' undeclared (first use in this function)
Batch.c:24: error: (Each undeclared identifier is reported only once
Batch.c:24: error: for each function it appears in.)
Batch.c:24: error: syntax error before '%' token
Batch.c:32:2: warning: no newline at end of file