I'm creating an zip file using 7zip from the command line during my build process. using a command like this:
7z.exe a -pPassword "..\sot.zip" .
This command works correctly and I'm able to see an encrypted file as expected. Now when I add the capability to encry0pte the headers
7z.exe a -mhe=on -pPassword "..\sot.zip" .
7z.exe a -mhe+ -pPassword "..\sot.zip" .
7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
Scanning
Creating archive sot.zip
System error:
The parameter is incorrect.
I get "The parameter is incorrect." errors regardless of where I put them on the command line.
Is there a way to perform the encryption of headers from the command line.
-mhe is not supported in .zip files. For it to work, use .7z format
7z.exe a -mhe=on -pPassword "..\sot.7z"
I did this, and it did work:
7z.exe a -psecret -mhe=on C:\newfolder\a.7z "C:\folder1\back-this-up"
Related
I'm working through a coding tutorial/book called Curious Moon. One of the assignments is to normalize and load data from a CSV file put in a Postgres table. The database name is "enceladus" and the table name is "master_plan". I was told to use make to do this. I can't figure out how to run the Makefile in PowerShell.
I installed GNUWin32 with make.exe on my Windows laptop running Windows 10. I used PowerShell to run make.exe. I did this by running notepad $profile and saved New-Item alias:make -Value 'C:\Program Files (x86)\GnuWin32\bin\make.exe' in the file. I gave it a new alias because I was getting an error message. Now when I'm calling the alias like this:
PS C:\Users\Sabrina> make
I'm getting this error:
make: *** No targets specified and no makefile found. Stop.
I wrote the Makefile in sublime and saved it as a makefile extension. It's in the same folder 'C:\Program Files (x86)\GnuWin32\bin' as make.exe and named Makefile. I tried running it as
PS C:\Users\Sabrina> make -f Makefile
and then I get the error
make: Makefile: No such file or directory
I'm not sure how to get the makefile to open and run.
This is my code in the Makefile:
DB=enceladus
BUILD=${CURDIR}/build.sql
SCRIPTS=${CURDIR}/scripts
CSV='${CURDIR}/data/master_plan.csv'
MASTER=$(SCRIPTS)/import.sql
NORMALIZE = $(SCRIPTS)/normalize.sql
all: normalize
psql $(DB) -f $(BUILD)
master:
#cat $(MASTER) >> $(BUILD)
import: master
#echo "COPY import.master_plan FROM $(CSV) WITH DELIMITER ',' HEADER CSV;" >> $(BUILD)
normalize: import
#cat $(NORMALIZE) >> $(BUILD)
clean:
#rm -rf $(BUILD)
Makefile is in C:\Program Files (x86)\GnuWin32\bin, but you're current working directory is C:\Users\Sabrina. When running make or make -f Makefile the command is looking for a Makefile in the current working directory, not in the directory where the executable resides.
Put the Makefile into your current working directory and the problem will disappear.
Move-Item 'C:\Program Files (x86)\GnuWin32\bin\Makefile' .
make
I am looking for the 7-zip command line call that is the equivalent to the explorer extension option of Add to "FolderName.zip":
I have tried:
& 7z C:\path\To\SecondAttempt, C:\path\to\SecondAttempt.zip
And I get the following
7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
Command Line Error:
Unsupported command:
C:\path\to\SecondAttempt,
Does anyone know the command line equivalent of the explorer extension for 7-Zip?
The shell extension invokes 7zG.exe, a GUI utility that shows a nice GUI window if this is what you were looking for. Using SysInternal ProcMon it's possible to look up the command line used, basically:
& "C:\Program files\7-Zip\7zG.exe" a -tzip -slp- "a.zip" "file1.txt" "file2.txt"
The file list can be put into a file and its name is specified after # instead of the file names.
-slp- disables large page mode, and -slp enables compression speedup of large files
Fo 7Zip this should be the correct syntax
. .\7z.exe a C:\path\to\SecondAttempt.zip "C:\path\To\SecondAttempt"
But I would prefer to use directly .NET
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::CreateFromDirectory("C:\path\To\SecondAttempt","C:\path\to\SecondAttempt.zip")
I have downloaded some files with PSFTP from a SQL Server. The problem is that PSFTP changes the dates of creation/update and last modified of the files when downloading them in a local folder. For me it is important to keep the original dates. Is there any command to set/change it? Thanks
This is the script of the batch file
psftp.exe user#host -i xxx.ppk -b abc.scr
This is the scriptof the SCR file
cd /path remote folder
lcd path local folder
mget *.csv
exit
I'm not familiar with PSFTP and after looking at the docs I don't see any option to do this. However, you can use the -p flag of pscp to preserve dates and times.
See docs here.
(note it's a lower-case p, the other case is for specifying the port)
I am using the FCIV ( Microsoft File Checksum Integrity Verifier ) executable to automatically calculate checksums for certain files.
I want to invoke this executable within a powershell script. This is my snippet within Powershell.
& "Path to FCIV.exe" –add "Base Dir" -bp "Base Dir" -r –xml "Path to XML"
This commands basically recurses and calculates checksums for all files under "Base Dir" and then outputs into an XML file. I am able to execute this command on Powershell prompt. But when I add this line into a script and execute the script, I get this error.
–add\*
Error msg : The system cannot find the path specified.
Error code : 3
I have tried everything from adding FCIV to PATH environment variable as well as providing the whole path to files.
Any suggestions on how to overcome this?
i have such problem. When i use command for 7zip:
7za a -t7z file.7z file.iso
i see in console dynamically changing output like this:
7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
Scanning
Creating archive file.7z
Compressing file.iso 12%
When i redirect output to file with command:
7za a -t7z file.7z file.iso >> file.txt
Im just getting final message:
7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
Scanning
Creating archive file.7z
Compressing file.iso
Everything is Ok
Why? I want all messages. What am i doing wrong?
it all is ok, I'm using exactly the same 7zip version under current stable debian 7.1 64bit.
7zip detects, stdout is assigned to terminal or not. when not to terminal, this in the background use option -bd , disable percentage indicator. developer assumes that you read log post factum, and do not analize output on the fly.
unfortunately it is not possible switch on percentages on the file. you can only switch off percentages on the screen.
what for you need % in log file.txt ?