Hi everyone, i'm trying to execute a .bat file through a c# console application using code from here:
[http://stackoverflow.com/questions/361097/c-sharp-service-cannot-execute-batch-file](stack overflow)
Kevin's solution kinda works, but some commands in my .bat file get ignored for some reason, but when i manually execute the .bat file all commands work just fine. e.g. xcopy command doesn't work while executing .bat from console app.
Any idea why this happens?

Recommended Answers

Did you check the environmental variables that your bat file is using (such as PATH)? It may not be able to find the commands you want it to execute.

Jump to Post

All 2 Replies

Did you check the environmental variables that your bat file is using (such as PATH)? It may not be able to find the commands you want it to execute.

I only use rmdir and xcopy in batch file, don't use no variables i think.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.