Search found 46 matches

by Yanta
08 May 2020 06:08
Forum: DOS Batch Forum
Topic: Read file1 and remove the lines in that file from file2
Replies: 8
Views: 1889

Re: Read file1 and remove the lines in that file from file2

Hmmm. I must have missed something. I tried /lixvg:<file>.... Don't /x and /v conflict? /x will write only the exact matches to the output file? I actually do want my cake and to eat it too. There are times when partial matches are desirable, but with the possibility of bad domains being mixed with ...
by Yanta
07 May 2020 21:31
Forum: DOS Batch Forum
Topic: Read file1 and remove the lines in that file from file2
Replies: 8
Views: 1889

Re: Read file1 and remove the lines in that file from file2

it works. A little too well. There are some domains that rely on users making typos - sites like ttwitter.com So when i have twitter.com in the source file, both twitter.com and ttwitter.com are removed from the target file. I get why this happens, but is there a way to prevent this? Perhaps I need ...
by Yanta
07 May 2020 09:59
Forum: DOS Batch Forum
Topic: Read file1 and remove the lines in that file from file2
Replies: 8
Views: 1889

Re: Read file1 and remove the lines in that file from file2

I spent hours messing with for loops... Didn't even think of using findstr.
I can't guarantee the first or any line will or won't have a dot. It's highly likely they will.
Thanks, I'll give it a go and let you know how it works out.
by Yanta
06 May 2020 23:10
Forum: DOS Batch Forum
Topic: Read file1 and remove the lines in that file from file2
Replies: 8
Views: 1889

Read file1 and remove the lines in that file from file2

Hello Again. I have two files. One is the Windows hosts file. The other contains a list of entries I want to remove from the hosts file. file1 is the file containing the lines to remove, file2 is %windir%\system32\drivers\etc\hosts. File1 may contain (full or partial domains). facebook www.twitter.c...
by Yanta
30 Apr 2020 23:26
Forum: DOS Batch Forum
Topic: Why does this work from a command line but not from a batch file
Replies: 6
Views: 2251

Re: Why does this work from a command line but not from a batch file

OMG! How embarrassing. That fixed it.

thanks for the help.
by Yanta
28 Apr 2020 07:45
Forum: DOS Batch Forum
Topic: Why does this work from a command line but not from a batch file
Replies: 6
Views: 2251

Re: Why does this work from a command line but not from a batch file

Windows typically forbids to create files in the root directory of system drives (typically "C:\"), so you should place your "Backup.log" file somewhere else. Fair point, though, I've never had an issue writing file to c:\. Some applications even default to there (DVDFab's junk folders, WinAeroTwea...
by Yanta
28 Apr 2020 07:31
Forum: DOS Batch Forum
Topic: Why does this work from a command line but not from a batch file
Replies: 6
Views: 2251

Re: Why does this work from a command line but not from a batch file

I fail to see where %root1809% is defined as a variable ughh! Sorry, that is my fault. It should say %RootDrv%... Typo. The code is "%RootDrv%\rar.exe" a -r -y -iddp -rr5 -ow -tsmcap -tl -dh -wG:\ -x"Kodi\userdata\Thumbnails" KodiPackage Kodi >>C:\Backup.log 2>&1 "%RootDrv%\rar.exe" a -r -y -iddp -...
by Yanta
24 Apr 2020 21:18
Forum: DOS Batch Forum
Topic: Why does this work from a command line but not from a batch file
Replies: 6
Views: 2251

Why does this work from a command line but not from a batch file

I have a batch file that backs up various files and settings on my PC for when I clean reinstall Windows. The following variables are set; set RootDrv=%cd% set SRC=%cd:~0,2% Set UserPath=%RootDrv%\%USERNAME% set AppPath=%UserPath%\Applications I write the contents of those to a log file which shows....
by Yanta
17 Mar 2020 23:06
Forum: DOS Batch Forum
Topic: WEVTUTIL CL fails if the event log channel has a space in it
Replies: 2
Views: 1597

WEVTUTIL CL fails if the event log channel has a space in it

for /f %%a in ( C:\LOGLIST.TXT ) do WEVTUTIL CL "%%a" The textfile is created from WEVTUTIL EL >>C:\LogList.txt For example, this: Internet Explorer will fail with error Failed to clear log Internet. The specified channel could not be found. Whereas HardwareEvents Will work fine. Only happens when c...
by Yanta
06 Sep 2019 06:24
Forum: DOS Batch Forum
Topic: retrieving drive details into variables
Replies: 11
Views: 4117

Re: retrieving drive details into variables

OMG! That's awesome code. Doesn't return any results for optical drives though. Snippet 1 # Set CD/DVD Drive to A: $cd = $NULL $cd = Get-WMIObject -Class Win32_CDROMDrive -ComputerName $env:COMPUTERNAME -ErrorAction Stop if ($cd.Drive -eq "D:") { Write-Output "Changing CD Drive letter from D: to A:"...
by Yanta
05 Sep 2019 02:14
Forum: DOS Batch Forum
Topic: retrieving drive details into variables
Replies: 11
Views: 4117

Re: retrieving drive details into variables

I'd have to go through my history to track down the powershell scripts. But I have a rather good discovery to share... Diskpart's list disk and list partition command work with hard disks and removable drives like USB drives, but not with optical drives. However, LIST VOL[ume] does list the optical ...
by Yanta
03 Sep 2019 22:02
Forum: DOS Batch Forum
Topic: retrieving drive details into variables
Replies: 11
Views: 4117

Re: retrieving drive details into variables

No problems. I did come here for help which you generously gave. It would be rude of me to presume that I'm right. I shall return it to it's original form. As for optical drives, we all still use them extensively. I may have 100TB on my server, but I keep running out. When I run out of space I remov...
by Yanta
02 Sep 2019 22:21
Forum: DOS Batch Forum
Topic: retrieving drive details into variables
Replies: 11
Views: 4117

Re: retrieving drive details into variables

Because DIskpart does not see optical drives.
I want to get each drive once. Processs them once.
I need the current drive letter so that when I call my powershell script it know which of the drives I want to reassign the drive letter for.
by Yanta
01 Sep 2019 19:01
Forum: DOS Batch Forum
Topic: retrieving drive details into variables
Replies: 11
Views: 4117

Re: retrieving drive details into variables

So close. USB drives respond to drivetype=2. Opticaldisks only respond to drivetype=5. That's OK, I need both So if I am reading this right, the drive letters are in a single string. I then need to split them out into separate variables. I tweaked your code thus; for /l %%i in (0 1 %idx%) do ( Rem e...