![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | 7z isn't a number Can someone help me? I'm trying to create a backup script that will tar the contains of a directory then zip the tar with a password. I'm using the program 7-Zip for both the tarring and zipping. If the directory being backed up has a backup.ps1 then the backup process is bypassed and the script is called instead. Powershell is interpreting the application "7z" as a number. What should I do? $root_dir = 'C:\Temp'; # this is for testing $ENV:PATH += 'C:\Program Files\7-Zip' $ds = [System.IO.Directory]::GetDirectories($root_dir); foreach ($d in $ds) { cd $d; if ([System.IO.File]::Exists($d + "/backup.ps1")) { powershell "backup.ps1"; } else { #cmd '7z a -ttar backup'; #cmd '7z a -tzip test.tar.zip -mem=AES256 -p123 backup'; } } |
My System Specs![]() |
| | #2 (permalink) | ||||||||||||
| Guest | Re: 7z isn't a number Were exactly doe's it fail? Can you provide the error description. BTW, when you add to the PATH environment variable make sure to prefix it with a semicolon: $ENV:PATH += ';C:\Program Files\7-Zip' If PATH conatins: "c:\windows;C:\temp" Then after you add to it it'll look like: C:\Program Files\7-Zip' ----- Shay Levi $cript Fanatic http://scriptolog.blogspot.com
| ||||||||||||
My System Specs![]() | |||||||||||||
| | #3 (permalink) | ||||||||||||
| Guest | Re: 7z isn't a number Were exactly doe's it fail, Can you provide the error description? BTW, when you add to the PATH environment variable make sure to precede it with a semicolon: $ENV:PATH += ';C:\Program Files\7-Zip' For instance, If PATH is: "c:\windows;C:\temp" After your addition it'll look like: "c:\windows;C:\tempC:\Program Files\7-Zip" ----- Shay Levi $cript Fanatic http://scriptolog.blogspot.com
| ||||||||||||
My System Specs![]() | |||||||||||||
| | #4 (permalink) | ||||||||||||||||||||||||
| Guest | Re: 7z isn't a number I've updated the script as you said. The following is the error that I'm getting. Bad numeric constant: 7z. At C:\Temp\backup_script.ps1:12 char:4 + 7z <<<< a -ttar backup $root_dir = 'C:\Temp'; $ENV:PATH += ';C:\Program Files\7-Zip' $ds = [System.IO.Directory]::GetDirectories($root_dir); foreach ($d in $ds) { if ([System.IO.File]::Exists($d + "/backup.ps1")) { powershell "$d/backup.ps1" } else { cd $d 7z a -ttar backup 7z a -tzip test.tar.zip -mem=AES256 -p123 backup } } "Shay Levi" <no@xxxxxx> wrote in message news:8766a9441c8938ca31b30d0fefd2@xxxxxx
| ||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||
| | #5 (permalink) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Guest | Re: 7z isn't a number On Jan 31, 9:21 am, "Mike King" <emai...@xxxxxx> wrote:
& "7z.exe" (with the ampersand and double-quotes). -- Kam-Hung Soh <a href="http://kamhungsoh.com/blog">Software Salariman</ a> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | #6 (permalink) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Guest | Re: 7z isn't a number Or simply use the PowerShell escape character: PS> `7z -- greetings dreeschkind "Kam-Hung Soh" wrote:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Number pad | BarryH | Vista hardware & devices | 0 | 10-04-2007 08:40 PM |
| mac number | dion | Vista hardware & devices | 4 | 02-04-2007 08:14 PM |
| build number | geroge | Vista General | 2 | 12-05-2006 10:20 AM |
| serial number | Andrian | Vista installation & setup | 7 | 11-20-2006 08:45 PM |
| Build Number??? | Kamal | Vista General | 4 | 11-09-2006 03:16 PM |