The filename, directory name, or volume label syntax is incorrect, c#


i've written a console application deploy.exe which runs a batch script.

Process p1 = new Process();
p1.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory + "installer.bat";
p1.StartInfo.WindowStyle = ProcessWindowStyle.Normal;

the installer.bat conatins the following command. \shared1\lists\list1.cmd

If i run the executable byitself it runs successfully.

However i needed it to run in a windows installer project. So i made a setup and deployment project and added the deploy.exe successfully as custom action upon install.

It runs fine but when it starts to execute the command i get this error "The filename, directory name, or volume label syntax is incorrect". any help?

3/7/2010 6:25:04 PM

Accepted Answer

the error seems to be inside the script which was being executed. It contained environment variables %kind%, which were not acceptable by the installer for some reason. So it was working properly outside the installer and not properly when the installer was calling it.

3/24/2009 10:27:56 AM

Is it a problem in your batch file?

Check this:


should probably be


Note the extra \ chars in your original command. That would cause the batch file to give that error.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow