Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

7z extraction , executing a dos command, variables not replaced

$
0
0

Hello

From a powershell script I would like to extract an aarchive to a particular directory using 7-zip

The dos command is:

C:\Progra~1\7-Zip\7z.exe x $rep\$archive -o$dir


when i run the script, it seems that $dir variable is not replaced by its value when executed because a directory named "$dir" is created in the current directory, as if the command launched is:

C:\Progra~1\7-Zip\7z.exe x c:\archive.zip -o$dir

assuming that $rep="c:" and $archive="archive.zip"

Do you know why my $dir variable is not replace while $rep and $archive are ?

For the moment I make 

cd $dir

and I don't specify the output dir, so it's extracted in the current. 

Maybe it's because ther's no space, but this program doesn't accept space after -o !


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>