Search found 26 matches

by Yanta
17 May 2020 04:16
Forum: DOS Batch Forum
Topic: Debugging / syntax checksing tools for batch
Replies: 21
Views: 399

Re: Debugging / syntax checksing tools for batch

The parenthesis was easy. I don't use ( or ) in comments if I can avoid it. So using notepad++ I counted the number of ( and ). 810 each, Now 819 each doe to removal of GOTOs Quotes are a little more difficult, so I just kept reading the script from start to end over and over, looking for " mismatch...
by Yanta
17 May 2020 03:57
Forum: DOS Batch Forum
Topic: Debugging / syntax checksing tools for batch
Replies: 21
Views: 399

Re: Debugging / syntax checksing tools for batch

No, I mean I removed any if statements that impeded my progress in debugging. Literally the only issue I could find was that the variables weren't set. There's nothing wrong with nested if statements. All good. There actually weren't any variables not set. I do actually have a not defined section a...
by Yanta
16 May 2020 21:08
Forum: DOS Batch Forum
Topic: Debugging / syntax checksing tools for batch
Replies: 21
Views: 399

Re: Debugging / syntax checksing tools for batch

I've just eliminated every GOTO in the script except the one to push the script to the end if it's not run from valid installation media.
That means adding more compound IF statements.
Ran it again.
Fails in EXACTLY the same place. The first non-remark statement after :L510.
by Yanta
16 May 2020 19:38
Forum: DOS Batch Forum
Topic: Debugging / syntax checksing tools for batch
Replies: 21
Views: 399

Re: Debugging / syntax checksing tools for batch

I wrote a script to echo a number after each line in your script. After getting to if /I "%DoGame:~0,1%"=="Y" ( it wouldn't progress past that. Since I know that code in parentheses gets parsed as a single block, I removed the if statement entirely. The script then continued on until it reached the...
by Yanta
16 May 2020 19:29
Forum: DOS Batch Forum
Topic: Debugging / syntax checksing tools for batch
Replies: 21
Views: 399

Re: Debugging / syntax checksing tools for batch

Doesn't matter that I put there, it will always be the first non-remark after the label. So, if you replace this line: IF /I NOT "%DoGame:~0,1%"=="Y" Echo %time% Not installing games >>C:\%USERDOMAIN%.PostInstall.Log 2>&1 with: echo 123 pause Your script fails? Absolutely. See above reply. It says ...
by Yanta
16 May 2020 19:27
Forum: DOS Batch Forum
Topic: Debugging / syntax checksing tools for batch
Replies: 21
Views: 399

Re: Debugging / syntax checksing tools for batch

Based solely on that snippet, it's failing because DoGame isn't set. My bad. I should have stated "You can assume all variables have been set". The code that does that is at the top of the script IF /I "%USERNAME%"=="Phillip" ( set DataDrv=F: set LogPath=F:\Logs set TempPath=G:\Temp2 set UserPath=F...
by Yanta
15 May 2020 23:52
Forum: DOS Batch Forum
Topic: Debugging / syntax checksing tools for batch
Replies: 21
Views: 399

Re: Debugging / syntax checksing tools for batch

Ouch. A$170. Well, I'll give it a go. Just out of curiosity, can anyone spot the bug here? The first non-remark after :L510 kills the script with 'the syntax of the command is invalid'. Doesn't matter that I put there, it will always be the first non-remark after the label. I've included the precedi...
by Yanta
14 May 2020 23:14
Forum: DOS Batch Forum
Topic: Debugging / syntax checksing tools for batch
Replies: 21
Views: 399

Re: Debugging / syntax checking tools for batch

1-4 done. Many times. Echo off removed. it only runs from command line. It has to be run as administrator. I extracted the section of code where it fails with the "syntax is invalid" and it works perfectly. So I added in the preceding section, tried again, still ok. Added the next section in and tri...
by Yanta
14 May 2020 05:29
Forum: DOS Batch Forum
Topic: Debugging / syntax checksing tools for batch
Replies: 21
Views: 399

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...
by Yanta
12 May 2020 06:54
Forum: DOS Batch Forum
Topic: Read file1 and remove the lines in that file from file2
Replies: 8
Views: 706

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...
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: 706

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: 706

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: 706

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: 706

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: 1255

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.