How to close a specific handle that is an "Event" Type in Sysinternals? - cmd

What I was doing is trying to close an "Event" Type via cmd.exe, Let's just say "\Sessions\1\BaseNamedObjects\ROBLOX_singletonEvent" in Sysinternals Process Explorer in Handles Menu:
RobloxPlayeBeta.exe "\Sessions\1\BaseNamedObjects\ROBLOX_singletonEvent"
you would see the Event Handle in the RobloxPlayerBeta.exe Process, But if I used the Handle.exe (The Command-Line Version of Handle GUI in Sysinternals) and used:
handle.exe -p RobloxPlayerBeta.exe
Result:
Nthandle v5.0 - Handle viewer
Copyright (C) 1997-2022 Mark Russinovich
Sysinternals - www.sysinternals.com
------------------------------------------------------------------------------
RobloxPlayerBeta.exe pid: 2272 JAMSTUDIOSLAPTO\jpfau
40: File (RW-) C:\Windows
2BC: File (RW-) C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.19041.1110_none_c0da534e38c01f4d
378: Section \Sessions\1\BaseNamedObjects\windows_shell_global_counters
3B0: File (RW-) C:\Program Files (x86)\Roblox\Versions\version-93fb1ddae5a243cc
3EC: File (RW-) C:\Users\jpfau\AppData\Local\Roblox\logs\0.550.0.5500640_20221102T023510Z_Player_CB912_last.log
498: File (RWD) C:\Windows\SysWOW64\kernel.appcore.dll
554: File (RWD) C:\Windows\SysWOW64\cryptsp.dll
558: File (RWD) C:\Users\jpfau\AppData\Local\Roblox\logs
564: File (RWD) C:\Users\jpfau\AppData\Local\Temp
568: Section \Sessions\1\Windows\Theme1270661836
590: Section \Windows\Theme1969318615
608: Section \Sessions\1\BaseNamedObjects\RBXMAINWND-4DAAC10B-9C9A-4471-9218-07310329FD0D
6B8: File (RWD) C:\Program Files (x86)\Roblox\Versions\version-93fb1ddae5a243cc\RobloxPlayerBeta.exe
6C4: File (RWD) C:\Windows\SysWOW64\user32.dll
6D0: File (RWD) C:\Windows\SysWOW64\cryptbase.dll
6D8: File (RWD) C:\Windows\SysWOW64\rpcrt4.dll
820: Section \BaseNamedObjects\__ComCatalogCache__
830: Section \BaseNamedObjects\__ComCatalogCache__
834: File (R--) C:\Windows\Registration\R00000000000d.clb
878: File (R-D) C:\Windows\System32\en-US\MMDevAPI.dll.mui
8F0: File (R--) C:\Program Files (x86)\Roblox\Versions\version-93fb1ddae5a243cc\PlatformContent\pc\fonts\NotoSansCJKjp-Regular.otf
8F8: File (R--) C:\Program Files (x86)\Roblox\Versions\version-93fb1ddae5a243cc\content\fonts\TwemojiMozilla.ttf
900: File (R--) C:\Program Files (x86)\Roblox\Versions\version-93fb1ddae5a243cc\content\fonts\RobloxEmoji.ttf
908: File (R--) C:\Program Files (x86)\Roblox\Versions\version-93fb1ddae5a243cc\content\fonts\NotoSansThaiUI-Regular.ttf
910: File (R--) C:\Program Files (x86)\Roblox\Versions\version-93fb1ddae5a243cc\content\fonts\NotoSansSinhalaUI-Regular.ttf
918: File (R--) C:\Program Files (x86)\Roblox\Versions\version-93fb1ddae5a243cc\content\fonts\NotoSansMyanmarUI-Regular.ttf
920: File (R--) C:\Program Files (x86)\Roblox\Versions\version-93fb1ddae5a243cc\content\fonts\NotoSansKhmerUI-Regular.ttf
928: File (R--) C:\Program Files (x86)\Roblox\Versions\version-93fb1ddae5a243cc\content\fonts\NotoSansGeorgian-Regular.ttf
930: File (R--) C:\Program Files (x86)\Roblox\Versions\version-93fb1ddae5a243cc\content\fonts\NotoSansDevanagariUI-Regular.ttf
938: File (R--) C:\Program Files (x86)\Roblox\Versions\version-93fb1ddae5a243cc\content\fonts\NotoSansBengaliUI-Regular.ttf
95C: File (RWD) C:\Windows\SysWOW64\gdi32.dll
A84: File (R--) C:\Users\jpfau\AppData\Local\Temp\Roblox\sounds\RBXDD9911DF9B634C3BB2FF5F376495436B
AB8: File (RWD) C:\Windows\SysWOW64\msvcrt.dll
AD8: File (RWD) C:\Windows\SysWOW64\sechost.dll
B0C: File (RWD) C:\Windows\SysWOW64\advapi32.dll
B10: File (RWD) C:\Windows\SysWOW64\wintrust.dll
B18: File (RWD) C:\Windows\SysWOW64\ucrtbase.dll
B20: File (RWD) C:\Windows\SysWOW64\bcryptprimitives.dll
B2C: File (RWD) C:\Windows\SysWOW64\msasn1.dll
B38: File (RWD) C:\Windows\SysWOW64\rsaenh.dll
B54: File (RWD) C:\Windows\SysWOW64\gdi32full.dll
B64: File (RWD) C:\Windows\SysWOW64\imm32.dll
B6C: File (RWD) C:\Windows\SysWOW64\combase.dll
B70: File (RWD) C:\Windows\SysWOW64\kernel32.dll
B94: File (RWD) C:\Windows\SysWOW64\msvcp_win.dll
BA4: File (RWD) C:\Windows\SysWOW64\version.dll
BAC: File (RWD) C:\Windows\SysWOW64\win32u.dll
BB4: File (RWD) C:\Windows\SysWOW64\winmm.dll
BC0: File (RWD) C:\Windows\SysWOW64\shell32.dll
BC4: File (RWD) C:\Windows\SysWOW64\KernelBase.dll
BDC: File (RWD) C:\Windows\SysWOW64\ntdll.dll
BE8: File (RWD) C:\Windows\SysWOW64\ole32.dll
BEC: File (RWD) C:\Windows\SysWOW64\crypt32.dll
BF4: File (RWD) C:\Windows\SysWOW64\oleaut32.dll
BF8: File (RWD) C:\Windows\SysWOW64\bcrypt.dll
------------------------------------------------------------------------------
RobloxPlayerBeta.exe pid: 960 JAMSTUDIOSLAPTO\jpfau
40: File (RW-) C:\Windows
84: File (RW-) C:\Program Files (x86)\Roblox\Versions\version-93fb1ddae5a243cc
You Would see that there is no "\Sessions\1\BaseNamedObjects\ROBLOX_singletonEvent" even though it is visible in the GUI in Process Explorer, The Reason I use 'handle -p' Is to know the hex numerical in the Left Side in order to close that handle by:
handle -c {Hex of Handle} -p {TargetProcess}
But Because The "Event" Handle doesn't seem to be listed in Handle.exe I can't close it, I can only close it in the GUI (Process Explorer), Is There a way where you can close a handle such as an "Event" Handle?

Related

Installing Google Cloud Cli Fails Windows

Please see the below error this comes up when installing the Google cloud CLI on windows
both as a Admin and as a regular user
I am installing it for all users with Bundled Python and cloud tools for PowerShell both checked
I don't understand the error any help or references why this happens and what could be done to fix this would be greatly appreciated
Thank you
Downloading Google Cloud CLI core.
Extracting Google Cloud CLI core.
Create Google Cloud CLI bat file: C:\Program Files (x86)\Google\Cloud SDK\cloud_env.bat
Installing components.
Welcome to the Google Cloud CLI!
Beginning update. This process may take several minutes.
This will install all the core command line tools necessary for working with
the Google Cloud Platform.
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\urllib3\connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\urllib3\connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\urllib3\connectionpool.py", line 1040, in _validate_conn
conn.connect()
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\urllib3\connection.py", line 414, in connect
self.sock = ssl_wrap_socket(
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\urllib3\util\ssl_.py", line 454, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\urllib3\util\ssl_.py", line 498, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "C:\Users\Msadmin\AppData\Local\Temp\tmp0oqwgmw3\python\lib\ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "C:\Users\Msadmin\AppData\Local\Temp\tmp0oqwgmw3\python\lib\ssl.py", line 1040, in _create
self.do_handshake()
File "C:\Users\Msadmin\AppData\Local\Temp\tmp0oqwgmw3\python\lib\ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\requests\adapters.py", line 439, in send
resp = conn.urlopen(
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\urllib3\connectionpool.py", line 785, in urlopen
retries = retries.increment(
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\urllib3\util\retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='dl.google.com', port=443): Max retries exceeded with url: /dl/cloudsdk/channels/rapid/components-2.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\bootstrapping\install.py", line 308, in <module>
main()
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\bootstrapping\install.py", line 285, in main
Install(pargs.override_components, pargs.additional_components)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\bootstrapping\install.py", line 155, in Install
InstallOrUpdateComponents(to_install, update=update)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\bootstrapping\install.py", line 197, in InstallOrUpdateComponents
_CLI.Execute(
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\cli.py", line 1013, in Execute
self._HandleAllErrors(exc, command_path_string, specified_arg_names)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\cli.py", line 1050, in _HandleAllErrors
exceptions.HandleError(exc, command_path_string, self.__known_error_handler)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\exceptions.py", line 549, in HandleError
core_exceptions.reraise(exc)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\exceptions.py", line 146, in reraise
six.reraise(type(exc_value), exc_value, tb)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\six\__init__.py", line 693, in reraise
raise value
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\cli.py", line 987, in Execute
resources = calliope_command.Run(cli=self, args=args)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\backend.py", line 807, in Run
resources = command_instance.Run(args)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\surface\components\update.py", line 125, in Run
update_manager.Update(
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\updater\update_manager.py", line 989, in Update
install_state, diff = self._GetStateAndDiff(
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\updater\update_manager.py", line 692, in _GetStateAndDiff
latest_snapshot = self._GetLatestSnapshot(version=version,
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\updater\update_manager.py", line 675, in _GetLatestSnapshot
return snapshots.ComponentSnapshot.FromURLs(
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\updater\snapshots.py", line 175, in FromURLs
data = [
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\updater\snapshots.py", line 176, in <listcomp>
(ComponentSnapshot._DictFromURL(
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\updater\snapshots.py", line 200, in _DictFromURL
response = installers.MakeRequest(url, command_path)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\updater\installers.py", line 114, in MakeRequest
return _RawRequest(url, headers=headers, timeout=timeout)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\updater\installers.py", line 162, in _RawRequest
return retryer.RetryOnException(
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\util\retry.py", line 201, in RetryOnException
exceptions.reraise(exc_info[1], tb=exc_info[2])
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\exceptions.py", line 146, in reraise
six.reraise(type(exc_value), exc_value, tb)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\six\__init__.py", line 693, in reraise
raise value
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\util\retry.py", line 182, in TryFunc
return func(*args, **kwargs), None
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\updater\installers.py", line 192, in _ExecuteRequestAndRaiseExceptions
response = requests_session.get(
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\requests\sessions.py", line 555, in get
return self.request('GET', url, **kwargs)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\transport.py", line 251, in WrappedRequest
response = orig_request(*modified_args, **modified_kwargs)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\requests.py", line 246, in WrappedRequest
return orig_request_method(*args, **kwargs)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\requests\sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\requests\sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\requests\adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='dl.google.com', port=443): Max retries exceeded with url: /dl/cloudsdk/channels/rapid/components-2.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))
Failed to install.

Oracle FORMS 12C - Generate password protected file from oracle forms application with CLIENT_TEXT_IO webutil

We have an application in Oracle forms. From a form, we generate a .TXT file with some data. Now we are looking for options to generate a password protected file (preferrably zip file as .TXT cannot be password protected directly)
We use CLIENT_TEXT_IO to write data into file and close.
Is it possible to generate password protected zip file with CLIENT_TEXT_IO webutil?
U_IN_FILE := CLIENT_TEXT_IO.FOPEN (:M_FILE_PATH || 'some data.TXT','w');
CLIENT_TEXT_IO.PUT_LINE(U_IN_FILE,'some data');
CLIENT_TEXT_IO.FCLOSE (U_IN_FILE);
I presume you'd do that in two steps:
create .txt file the way you're already doing it
use CLIENT_HOST to invoke command-line ZIP utility and create a password-protected ZIP file
For example, on my MS Windows, using 7-zip, it would look like this:
c:\Temp\ZIP>"C:\Program Files\7-Zip\7z" a zipped_file.7z test.txt -pMARCH18
7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21
Scanning the drive:
1 file, 66 bytes (1 KiB)
Creating archive: zipped_file.7z
Add new data to archive: 1 file, 66 bytes (1 KiB)
Files read from disk: 1
Archive size: 202 bytes (1 KiB)
Everything is Ok
c:\Temp\ZIP>
ZIP command itself, explained:
7z a zipped_file.7z test.txt -pMARCH18
7z - invokes the utility
a - add to archive
zipped_file.7z - ZIP file name
test.txt - this is the file I'm going to ZIP
-pMARCH18 - password is MARCH18
Regarding the error calling Winzip, refer to these MyOracleSupport Notes:
1568659.1
1547133.1
In short, you will need to escape some of the characters in your call.

how to find a file in memory using volatility

There is an IMViewer.exe process in memory and open them file IMMAIL.IMM
vol.py -f d:\dump\dump\CRM-20180416-165859.dmp --profile=Win2012R2x64_18340 --kdbg=0xf80173c3f8e0 dlllist -p 8256 > dlllist.txt
IMViewer.EXE pid: 8256
Command line : "C:\Program Files (x86)\Inbit\Inbit Messenger Server\IMViewer.exe" "C:\Program Files (x86)\Inbit\Inbit Messenger Server\USER_ACCT\00001\IMMAIL.IMM"
Note: use ldrmodules for listing DLLs in Wow64 processes
Base Size LoadCount Path
------------------ ------------------ ------------------ ----
0x0000000000400000 0x208000 0x0 C:\Program Files (x86)\Inbit\Inbit Messenger Server\IMViewer.exe
0x00007ffca1a20000 0x1ad000 0x0 C:\Windows\SYSTEM32\ntdll.dll
0x0000000077850000 0x4b000 0x0 C:\Windows\SYSTEM32\wow64.dll
0x00000000777e0000 0x68000 0x0 C:\Windows\system32\wow64win.dll
0x00000000777d0000 0x9000 0x0 C:\Windows\system32\wow64cpu.dll
Execution
vol.py -f d:\dump\dump\CRM-20180416-165859.dmp --profile=Win2012R2x64_18340 --kdbg=0xf80173c3f8e0 dumpfiles -r IMM$ -i --name -D FileHandles/
does not find the file .IMM in memory.
The file IMMAIL.IMM is open and I can use it, but it was deleted from the disk and it could not be restored. Program IMViewer.EXE - Viewer and I cannot save the file IMMAIL.IMM. I wanted to find the file IMMAIL.IMM in memory and save it using dumpfiles, but the file can't be found. What can I do to find a file IMMAIL.IMM in memory?
Kinda new to this but this may help `Vol.py -f {file} --profile{profile} filescan | grep .ILL [ or the absoulute name fo the program instead ] and extract the file

Uncompress recursively using 7-Zip from command line

I'm attempting to uncompress several .gz files using 7-Zip from the command line. My files are in directories like so:
Desktop/copyto/1/
file1.gz
file2.gz
Desktop/copyto/2/
file1.gz
file2.gz
file3.gz
I would like to recursively uncompress all the .gz files into each's orginal location and as well as deleting the remaining .gz files when they are done uncompressing.
I have tried the following command with no luck:
7z.exe x C:\Users\MYUSERNAME\Desktop\copyto\*\*.gz -r
I assumed that this would extract recursively. I get the error:
Processing archive: C:\Users\MYUSERNAME\Desktop\copyto\1\file1.gz
Can not open output file file1
Sub items Errors: 1
Any idea what's going on?
Given your command line, my guess is that your current working directory isn't any subdirectory of your home directory (C:\Users\MYUSERNAME) or the public user directory (C:\Users\Public), which means you probably don't have access rights. For example, if I run the following from C:\Program Files\7-Zip, I get the same error with a 7-Zip file:
C:\Program Files\7-Zip>7z x C:\Users\MYUSERNAME\Desktop\migrated\annex_k.7z -r
7-Zip [64] 9.38 beta Copyright (c) 1999-2014 Igor Pavlov 2015-01-03
Processing archive: C:\Users\MYUSERNAME\Desktop\migrated\annex_k.7z
ERROR: Can not open output file : .\annex_k\include\annex_k\errno.h
Skipping annex_k\include\annex_k\errno.h
ERROR: Can not open output file : .\annex_k\include\annex_k\handler.h
Skipping annex_k\include\annex_k\handler.h
...
Extracting annex_k\include\annex_k
Extracting annex_k\include
Extracting annex_k
Sub items Errors: 10
Archives with Errors: 1
Sub items Errors: 10
Kernel Time = 0.031 = 39%
User Time = 0.031 = 39%
Process Time = 0.062 = 78% Virtual Memory = 3 MB
Global Time = 0.080 = 100% Physical Memory = 4 MB
Notice that not even an annex_k directory was created:
C:\Program Files\7-Zip>dir /b
7-zip.chm
7-zip.dll
7-zip32.dll
7z.dll
7z.exe
7z.sfx
7zCon.sfx
7zFM.exe
7zG.exe
descript.ion
History.txt
Lang
License.txt
readme.txt
The solution is to extract to a directory in which you have access rights. You can specify an output directory using something like -oC:\Users\MYUSERNAME\Desktop\copyto\1. If you absolutely need to do this in a directory in which you don't have write access ordinarily, you'd need to run the command prompt as an administrator and extract the file as usual.

7zip command line - archive name from source file name

How can I read name of source file and send it as archive name in 7zip using cmd archive option.
Now I use:
7z a -t7z V:\archive.7z V:\Backup\*.bak
I want to check bak namefile in V:\Backup (there is always only 1 file) and send it as archive.7z - for example if in V:\Backup is 1 file named "20131028_1100.bak" I want to name archive "20131028_1100.7z"
I found this to work:
Get-ChildItem *txt | ForEach-Object {.\7zr.exe a -t7z $($_.Name).replace('.txt','.7z') $_.FullName}
Example:
PS C:\tools> ls
Directory: C:\tools
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2022/08/01 11:00 578048 7zr.exe
-a---- 2022/08/01 11:02 7 hello.txt
PS C:\tools> Get-ChildItem *txt | ForEach-Object {.\7zr.exe a -t7z $($_.Name).replace('.txt','.7z') $_.FullName}
7-Zip (r) 22.01 (x86) : Igor Pavlov : Public domain : 2022-07-15
Scanning the drive:
1 file, 7 bytes (1 KiB)
Creating archive: hello.7z
Add new data to archive: 1 file, 7 bytes (1 KiB)
Files read from disk: 1
Archive size: 133 bytes (1 KiB)
Everything is Ok
PS C:\tools> ls
Directory: C:\tools
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2022/08/01 11:00 578048 7zr.exe
-a---- 2022/08/01 11:20 133 hello.7z
-a---- 2022/08/01 11:02 7 hello.txt
PS C:\tools> ls
you need a .bat script that execute a FOR command like this:
for %%X in (*) do "7zip\App\7-Zip\7z.exe" a "%%~nX.zip" "%%X"
%%X will catch the file name of every file contained in the folder where you will execute the script (in this case V:\Backup\ and only 1 file would be processed), so %%~nX.zip will take that file name
7zip keep source file name to archive
As "capa" said, it is necessary to use shell commands, because 7zip does not provide a command for this case.
The following edited command is available in order to operate with *.bak files and it is working for "7z" compression extension. It is more efficient than "zip" format in compression rate.
7z Format
FOR %%I IN (.bak) DO "c:\Program Files\7-Zip\7z.exe" a -t7z %%~nI.7z %%~nI.
zip Format
FOR %%I IN (.bak) DO "c:\Program Files\7-Zip\7z.exe" a -tZip %%~nI.zip %%~nI.
In the above commands the " * " symbol before .bak is not appeared. Please add it!
Also add the " * " to the end of each command.
*Create a "bat" file for example "compressbak.bat" on *.bak files directory, copy and paste the preferred command(7z or zip), "Save" the content on "compressbak.bat"! This will create named archives of *.bak files in the same folder that *.bak files saved. Also if you running on Windows x64 and you have a x86 version of 7-Zip you have to follow the right path in order to call the 7z.exe file. "c:\Program Files (x86)\7-Zip\7z.exe"
Folder and bat file content!
I hope that it helps you!!!

Resources