5

I want to do a recovery of files with commas in their names from the command line, ala:

wbadmin start recovery -version:10/01/2013-12:00 -itemType:File -overwite:Overwrite -quiet "-Items:C:\Path\To\File, With Comma.txt,C:\Path\To\File 2, With Comma.txt"

So there are two files:

  1. C:\Path\To\File, With Comma.txt
  2. C:\Path\To\File 2, With Comma.txt

The problem is wbadmin assumes commas separates each file, so it sees 4 files specified instead of 2. I've tried putting a \ in front of commas that are part of the file names like so:

wbadmin start recovery -version:10/01/2013-12:00 -itemType:File -overwite:Overwrite -quiet "-Items:C:\Path\To\File\, With Comma.txt,C:\Path\To\File 2\, With Comma.txt"

but it doesn't work, it just says there's a syntax error. The documentation on Technet doesn't seem to mention anything that'll help either.

OS is Windows Server 2008 R2.

A clarifying comment: I've changed the file names to be different than the actual names to be less revealing, but I also see I dumbed it down too much. The comma can occur either in the file name itself like C:\Path\To\File, With Comma.txt or in the path to the file, like: C:\Path, To\Other\File.txt.

dlp
  • 151
  • 3
  • 1
    Have you tried changing `C:\Path\To\File, With Comma.txt` to `"C:\Path\To\File, With Comma.txt"`? Normally in command line syntax you can use double quotes to prevent the command from assuming it is the next parameter. – TheCleaner Oct 23 '13 at 14:42
  • @TheCleaner - You beat me to it... – joeqwerty Oct 23 '13 at 14:44
  • Originally, I did wrap the entire `"-Items:..."` command like that because of the spaces in the name. Changing it to `-Items:"C:\Path\To\File, With Comma.txt","C:\Path\To\File 2, With Comma.txt"` doesn't work either. If I specify one file, the error says the files aren't in the same directory. If I specify both files, it just says syntax error. – dlp Oct 23 '13 at 14:57
  • same for `C:\Path\To\"File, With Comma.txt"`? Is it the same files each time for you? I ask because I would think you could use the 8.3 shortname instead. – TheCleaner Oct 23 '13 at 15:18
  • Nope. If you're not careful, you do weird things on the command line from that. `C:\Path\To\"File, With Comma.txt"` shows up in the program as `C:\Path\To\"File, With Comma.txt` as if the quote was in the name because of escaped characters in the command prompt. To do what you're saying, it's really `C:\Path\To\\"File.txt"` but that still bombs out saying they need to be in the same directory. – dlp Oct 23 '13 at 15:22
  • @TheCleaner, I just noticed your note about 8.3 shortnames. On Server 2008 R2 (maybe before this, not sure), shortnames are disabled. Need to set a registry key and reboot the server, which isn't an option right now because it's in use. Not even sure it'll fix it either. – dlp Oct 23 '13 at 15:27
  • What if you escape with a backtick? Something like -Items:"C:\Path\To\File, With Comma.txt"? (sorry markdown won't let me put a backtick in easily in comments) – TheCleaner Oct 23 '13 at 15:29
  • Nope. Says specified path can't be found, cuts it off at the comma still (C:\Path\To\File can't be found). I do appreciate your tenacity. – dlp Oct 23 '13 at 15:33
  • I wonder if you could run it in Powershell and set the first filename/path to be a variable? Then insert the variable as `-Items:File$`...just guessing at this point though. – TheCleaner Oct 23 '13 at 16:14
  • What about replacing the comma with the wildcard (*) or question mark character? This may not work for a comma appearing in a directory name, but it could work for the instance appearing in a filename. – I say Reinstate Monica Oct 07 '14 at 02:23
  • According to http://ss64.com/nt/syntax-esc.html and http://www.robvanderwoude.com/escapechars.php the escape charater is '^'. Does that work? – john Oct 07 '14 at 07:43

0 Answers0