Author Topic: Batch file mystery  (Read 468 times)

jj2007

  • Member
  • *****
  • Posts: 13657
  • Assembly is fun ;-)
    • MasmBasic
Batch file mystery
« on: May 30, 2022, 09:08:20 PM »
As posted earlier here: Works fine in Windows 7-64, but Windows 10 needs the inverse logic of if not exist, i.e. it works only if you use

if exist \Masm64\bin\ml64.exe (
  echo You need to download ml64.exe

I can't see any error in my code. Googling "windows 10" "batch" "if" "else" "not exist" reveals that Micros*t wants us to abandon batch files and use PowerShell instead. This is madness :cool:

Code: [Select]
if not exist D:\masm64\bin\ml64.exe echo dammit, no ml64
if not exist D:\Masm64\bin\RC.exe echo dammit, no rc
if not exist D:\masm64\bin\polink.exe echo dammit, no polink

3x dammit, and of course the files exist. They even work, i.e. they assemble the source just fine...!

This works fine, no "dammit":
Code: [Select]
if not exist D:\masm32\bin\ml.exe echo dammit, no ml32
if not exist D:\Masm32\bin\RC.exe echo dammit, no rc32
if not exist D:\masm32\bin\polink.exe echo dammit, no polink32
« Last Edit: May 30, 2022, 10:29:54 PM by jj2007 »

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10314
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Batch file mystery
« Reply #1 on: May 30, 2022, 11:09:40 PM »
 :biggrin:

This runs on my win 10 OK.

@echo off

  if exist ml64.exe goto yes

  @echo Nope its not there
  goto bye

:yes
  @echo yirp !

:bye
  @echo Thats all folks !

  pause
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

jj2007

  • Member
  • *****
  • Posts: 13657
  • Assembly is fun ;-)
    • MasmBasic
Re: Batch file mystery
« Reply #2 on: May 31, 2022, 12:04:46 AM »
Thanks, Hutch - your code made me find the error :thumbsup: