Batch File Output Error: The filename, directory name, or volume label syntax is incorrect.

Answered Batch File Output Error: The filename, directory name, or volume label syntax is incorrect.

  • Thursday, January 19, 2012 7:53 PM
     
      Has Code
    I have the following in a batch file: "C:\Program Files\VisualSVN Server\bin\svnadmin" dump "D:\Repositories\REPO" > "D:\Repositories Backups\RepoBackup-%date:~4,2%-%date:~7,2%-%date:~10,4%.svn" This batch file is embedded in my console app. It is then written to the assembly execution directory like so: [code]using (Stream input = assembly.GetManifestResourceStream("BackupUtility.SVN.svnbackup.bat")) using (Stream output = File.Create(path + @"\BackupUtility.SVN.svnbackup.bat")) { CopyStream(input, output); } private static void CopyStream(Stream input, Stream output) { byte[] buffer = new byte[8192]; int bytesRead; while ((bytesRead = input.Read(buffer, 0, buffer.Length)) > 0) { output.Write(buffer, 0, bytesRead); } }[/code] The output shows funky characters when the batch file is run: output>> D:\BackupUtility>"C:\Program Files\VisualSVN Server\bin\svnadmin" dump "D:\Repositories\REPO" 1>"D:\Repositories Backups\RepoBackup-01-19-2012.svn" error>>The filename, directory name, or volume label syntax is incorrect. Any ideas? ExitCode: 1

All Replies

  • Thursday, January 19, 2012 7:58 PM
     
     
    Well, I tried to fix the formatting but I don't see any rich text editors, just broken images and JavaScript. Guess I'll have to try somewhere else...
  • Friday, January 20, 2012 6:50 AM
    Moderator
     
     Answered

    It would be a encoding problem in your code, or there's different encoding char in your original .bat file.

    You can try to open your bat file and delete the unnecessary blank, and then save it in ANSI, then test.

    If the problem also cannot be solved, then please share us the completed code and the bat file, zip them and then share through the skydrive.

    Then let me know how to get the "output>>" and "error>>" string when I run your code in my local side.

     


    Mike Zhang[MSFT]
    MSDN Community Support | Feedback to us
  • Friday, January 20, 2012 1:34 PM
     
     
    I had a feeling it was encoding problem but wasn't exactly sure how to fix it. Ended up resaving the file in ANSI and that appears to have fixed it. Cheers!
  • Saturday, January 21, 2012 4:55 AM
    Moderator
     
     
    You're welcome!
    Mike Zhang[MSFT]
    MSDN Community Support | Feedback to us