Search found 31 matches

by Queue
24 Mar 2013 02:04
Forum: DOS Batch Forum
Topic: Help running assemly code I want to wrap in a batch file
Replies: 3
Views: 1118

Re: Help running assemly code I want to wrap in a batch file

That book is from 1993 and is undoubtedly teaching you 16-bit assembly, which is effectively worthless. 64-bit Windows cannot run 16-bit executable code. The error message you're getting is almost definitely the opaque ''this is a 16-bit executable'' error message on modern Windows. If your book is ...
by Queue
10 Mar 2013 19:11
Forum: DOS Batch Forum
Topic: Remember and Recall Directory Path?
Replies: 1
Views: 892

Re: Remember and Recall Directory Path?

Digging through some old Win9x batch files I have, I adapted a line that MIGHT work for you. echo exit|%COMSPEC% /K prompt CD $P$_|find " " > recall.bat To restore your location, you'd use: call recall.bat What it's actually doing is starting a new instance of command.com, changing the pro...
by Queue
06 Mar 2013 18:13
Forum: DOS Batch Forum
Topic: Question About Quotation Marks
Replies: 16
Views: 3058

Re: Question About Quotation Marks

Ok, here's an overly verbose version to play with. test36.bat @setlocal @echo off :: echo on & prompt;::$S$T$_ setlocal enabledelayedexpansion :: path; & dpath; & set pathext=; set ""=^" & set "{=!CMDCMDLINE!" echo [!{:*%~dp0=!] if not "!{:~10,1!"==...
by Queue
05 Mar 2013 22:18
Forum: DOS Batch Forum
Topic: Question About Quotation Marks
Replies: 16
Views: 3058

Re: Question About Quotation Marks

The whole point of the code is to check how the batch was started. Only if it was started ''normally'' i.e. via ShellExecute, double-click in Explorer, or via a command that has to be specifically made to look like those, should the " env var be defined. In other cases, like when run via a comm...
by Queue
05 Mar 2013 17:03
Forum: DOS Batch Forum
Topic: Question About Quotation Marks
Replies: 16
Views: 3058

Re: Question About Quotation Marks

I hadn't seen that solution, and I'm happy to, because I had early on tried unsuccessfully to redirect a REM. I had read part of that DosTips thread related to it though, about the redirection madness. Keep in mind that the point of this big mess is simply to safely check if the 3rd character of %0 ...
by Queue
05 Mar 2013 04:55
Forum: DOS Batch Forum
Topic: Question About Quotation Marks
Replies: 16
Views: 3058

Re: Question About Quotation Marks

The double call is to break up parsing into 3 passes. The first pass is carefully controlled and we precisely know the output: call(%%CMDCMDLINE:**=*%0%%_error_3 Otherwise, during this first pass, if %0 had already been expanded, inserted quotation marks, ampersands, etc. could blow everything up. A...
by Queue
04 Mar 2013 17:26
Forum: DOS Batch Forum
Topic: need help with batch file to edit two text files
Replies: 19
Views: 4686

Re: need help with batch file to edit two text files

See the line:

Code: Select all

         ) Else ( Echo !Line! )

Try changing it to:

Code: Select all

         ) Else ( Echo !Line!)

Notice I removed the space between ! and )

Queue
by Queue
04 Mar 2013 16:59
Forum: DOS Batch Forum
Topic: build a script via batch
Replies: 4
Views: 1094

Re: build a script via batch

I think he's asking for a way to call the ''build_all'' command on the script file (instead of, say, ''open''). autonicknan, if you check what the build_all option is doing, you can call the same command directly via batch. Alternatively, there are some 3rd party utilities that will let you ShellExe...
by Queue
04 Mar 2013 15:16
Forum: DOS Batch Forum
Topic: Question About Quotation Marks
Replies: 16
Views: 3058

Re: Question About Quotation Marks

Whew, those are devilish. This isn't a complete solution, but it might be on the right track; if nothing else, it makes things more readable and makes spotting where things are choking easier: test32&if;exists;2.bat @setlocal @echo off :: @prompt;::$S$T$_ setlocal enabledelayedexpansion set &quo...
by Queue
04 Mar 2013 04:21
Forum: DOS Batch Forum
Topic: Question About Quotation Marks
Replies: 16
Views: 3058

Re: Question About Quotation Marks

To be fair, the CMDCMDLINE checks would prevent that from being a problem under normal circumstances; I had to make a second batch file that I run via double-click that then calls the original batch file via "&"^&\..\ to get it to explode. I also went further and named it test30^=&...
by Queue
03 Mar 2013 03:52
Forum: DOS Batch Forum
Topic: Question About Quotation Marks
Replies: 16
Views: 3058

Re: Question About Quotation Marks

Got it, and now I see what a fluke it was that using " as my env var name was making set ""=%0" work when %0 had enclosing quotation marks. Since putting an & in the name of the .bat file as per your example certainly shows where things break, I've gone with that for testing ...
by Queue
01 Mar 2013 22:30
Forum: DOS Batch Forum
Topic: Question About Quotation Marks
Replies: 16
Views: 3058

Re: Question About Quotation Marks

jeb wrote:Now start it with

Code: Select all

cat^&dog.bat


It fails with an interesting effect :shock:,

jeb

Ok, that is madness.

Queue
by Queue
01 Mar 2013 15:48
Forum: DOS Batch Forum
Topic: Question About Quotation Marks
Replies: 16
Views: 3058

Re: Question About Quotation Marks

Haha, yeah, I know some of the other special characters make this explode. I'm just confused by the quotation marks though. As a simpler example: set ""="hello jeb"" Why does this work? Why doesn't the first quotation mark pair with the next quotation mark (and break everyth...
by Queue
28 Feb 2013 19:50
Forum: DOS Batch Forum
Topic: delims question
Replies: 8
Views: 2246

Re: delims question

Can you do delims=(xyz)(abc)? for /f "tokens=2 delims=(jk)(lm)" %a in ("onejktwolmthree") do echo %a for /f "tokens=3 delims=(jk)(lm)" %a in ("onejktwolmthree") do echo %a at the command prompt gaves the results "two" and "three" I'm not su...
by Queue
28 Feb 2013 18:53
Forum: DOS Batch Forum
Topic: Question About Quotation Marks
Replies: 16
Views: 3058

Question About Quotation Marks

As jeb's answer here: http://www.dostips.com/forum/viewtopic.php?f=3&t=4345 highlighted, quotation marks in env vars often make if statements explode. We wrap each side of the comparison in quotation marks to avoid other problems. So when I was working on something to check if a batch was run vi...