0

I´d like to untar a tar.gz file with 7-Zip using this command:

forfiles /M *tar.gz /C "cmd /c "C:\Program Files\7-Zip\7z" e @path"

but I can´t make it work because of the whitespace within Program Files. How can I escape it?

Update:

My alternative solution is:

set 7ZPath="C:\Program Files\7-Zip\7z"
%7ZPath% e *.tar.gz
Luis Andrés García
  • 5,852
  • 10
  • 43
  • 57

2 Answers2

1

forfiles /M *tar.gz /C "cmd /c "%ProgramFiles%\7-Zip\7z" e @path"

Abhineet
  • 5,320
  • 1
  • 25
  • 43
  • This would make the code more robust if it worked - Use of the environment variable instead of hard coding makes the code more portable. But it does not solve the problem of the dissapearing quotes causing white space problem. – dbenham Jan 22 '13 at 13:56
1

Quotes within your FORFILES command string must be escaped as \"

forfiles /M *tar.gz /C "cmd /c \"C:\Program Files\7-Zip\7z\" e @path"
dbenham
  • 127,446
  • 28
  • 251
  • 390