Search found 48 matches
- 14 May 2020 05:29
- Forum: DOS Batch Forum
- Topic: Debugging / syntax checksing tools for batch
- Replies: 27
- Views: 23397
Debugging / syntax checksing tools for batch
One of my scripts is 6,000 lines long. It has a bug. Invalid syntax or some such. I've spent a week going over the code so many times. I've checked of unbalanced parenthesis, quotes and so on. Damned if I can find it. So I used the batcodecheck program, but it's very basic and doesn't find any issue...
- 12 May 2020 06:54
- Forum: DOS Batch Forum
- Topic: Read file1 and remove the lines in that file from file2
- Replies: 8
- Views: 6388
Re: Read file1 and remove the lines in that file from file2
OMG!!! I'm a dummy... Flawed logic The master Hosts file is on my PC. As various lists are updated on github they are applied to the file I have. So that file has everything. The process I've currently been working on REMOVES lines from Hosts based on lines in another text file. I have another scrip...
- 08 May 2020 06:08
- Forum: DOS Batch Forum
- Topic: Read file1 and remove the lines in that file from file2
- Replies: 8
- Views: 6388
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 ...
- 07 May 2020 21:31
- Forum: DOS Batch Forum
- Topic: Read file1 and remove the lines in that file from file2
- Replies: 8
- Views: 6388
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 ...
- 07 May 2020 09:59
- Forum: DOS Batch Forum
- Topic: Read file1 and remove the lines in that file from file2
- Replies: 8
- Views: 6388
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.
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.
- 06 May 2020 23:10
- Forum: DOS Batch Forum
- Topic: Read file1 and remove the lines in that file from file2
- Replies: 8
- Views: 6388
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...
- 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: 6000
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.
thanks for the help.
- 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: 6000
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...
- 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: 6000
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 -...
- 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: 6000
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....
- 22 Mar 2020 05:53
- Forum: DOS Batch Forum
- Topic: WEVTUTIL CL fails if the event log channel has a space in it
- Replies: 2
- Views: 3622
Re: WEVTUTIL CL fails if the event log channel has a space in it
That works. Thanks for your help.
- 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: 3622
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...
- 06 Sep 2019 06:24
- Forum: DOS Batch Forum
- Topic: retrieving drive details into variables
- Replies: 11
- Views: 10618
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:"...
- 05 Sep 2019 02:14
- Forum: DOS Batch Forum
- Topic: retrieving drive details into variables
- Replies: 11
- Views: 10618
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 ...
- 03 Sep 2019 22:02
- Forum: DOS Batch Forum
- Topic: retrieving drive details into variables
- Replies: 11
- Views: 10618
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...