Computing.Net > Forums > Programming > BATCH call all files with str=1

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

BATCH call all files with str=1

Reply to Message Icon

Name: barteld
Date: January 21, 2004 at 11:11:29 Pacific
OS: windows XP
CPU/Ram: tb1333/256sd
Comment:

Hi,
im having this weird problem..

in fix.bat, %%? should be the filename.. but it isnt.

first when get_item_dsc=1 i call a batch file in the items folder, it returns %activatekey%, and then it should compare the userinput with %activatekey%, and then it should again call the same batch file but this time with get_item_dsc=0.

but its not working could somebody please give my script the finishing touch?

the error i have (4 times repeated) with any userinput i give:
'\My_Batch_menu\items\?' is not recognized as an internal or external command,
operable program or batch file.
Called the file

FOR %%? IN (*.bat) DO call %folder_runfiles%\fix.bat

fix.bat:
@echo off
set get_item_dsc=1
call %folder_runfiles%\items\%%?
set get_item_dsc=0

if not %userinp%==%activatekey% goto skip
call %folder_runfiles%\items\%%?
echo Called the file
goto end
:skip
echo skipped a file
:end

PS im fully aware this is a crosspost and my topic in WindowsXP forum should be deleted not this one (A)



Sponsored Link
Ads by Google

Response Number 1
Name: dtech10
Date: January 21, 2004 at 13:43:02 Pacific
Reply:

Try this, I think it's what your trying to do.
You need to pass the bat file as a parameter which becomes %1 to fix.bat


FOR %%? IN (*.bat) DO call %folder_runfiles%\fix.bat %%?

fix.bat:
@echo off
set get_item_dsc=1
call %folder_runfiles%\items\%1
set get_item_dsc=0

if not %userinp%==%activatekey% goto skip
call %folder_runfiles%\items\%1
echo Called the file
goto end
:skip
echo skipped a file
:end



0

Response Number 2
Name: Code One
Date: January 21, 2004 at 13:44:50 Pacific
Reply:

FOR %%x IN (*.bat) DO call fix.bat %%x

try that...

did that help?


0

Response Number 3
Name: Code One
Date: January 21, 2004 at 13:46:08 Pacific
Reply:

dtech posted 1 sec before me...

lol


0

Response Number 4
Name: barteld
Date: January 22, 2004 at 14:02:06 Pacific
Reply:

its f---ed up now im totally confused (and im a php expert :'( ) :s


0

Response Number 5
Name: dtech10
Date: January 22, 2004 at 16:06:35 Pacific
Reply:

Hi
The for command calls fix.bat with the *.bat file names as a parameter.
say you have two batch files called One.bat & Two.bat in the current directory, then fix.bat is called twice like this..
"call %folder_runfiles%\fix.bat One.bat"
and again as...
"call %folder_runfiles%\fix.bat Two.bat"


One.bat & Two.bat are your %%?


But to the batch file fix.bat %%? would be refered to as %1
If there were two parameters then the second one is refered to as %2. %0 refers to the filename itself ie. fix.bat

so if fix.bat have this command in it.

echo %0 %1

it would be called twice in my case and echo to the screen.
fix.bat One.bat
fix.bat Two.bat

Hope this helps


0

Related Posts

See More



Response Number 6
Name: barteld
Date: January 22, 2004 at 17:27:03 Pacific
Reply:

hi i now have this
FOR %%? IN (*.bat) DO call %folder_runfiles%\fix.bat %%?

fix.bat:
set get_item_dsc="1"
call %folder_runfiles%\items\%1
set get_item_dsc="0"
if %userinp%==%activatekey% call %folder_runfiles%\items\%1

now the last if simply gets ignored and it calls every file every time..
if i check with echo on it says
c:\blabla\if a==b call blabla
c:\blabla\call blabla

it just simply calls the file even when i dont want to..


0

Response Number 7
Name: barteld
Date: January 22, 2004 at 17:29:53 Pacific
Reply:

omg now it works its magic..


0

Response Number 8
Name: barteld
Date: January 22, 2004 at 17:41:47 Pacific
Reply:

let me explain my happiness :D
ive made some simple script that allows me to make very simple formatted batch files
like this

set activatekey=A
set item_dsc= 2- Kill Instant messengers

echo %activatekey% ----- %item_dsc%
if %get_item_dsc%=="1" goto skip

rem launch stuff here
taskkill /F /IM miranda32.exe /IM msmsgr.exe /IM msnmsgr.exe /IM MSN_Winamp_auto_nick_changer_V.1.0.exe

:skip

this menu script doesnt works with errorlevels (Except a few). instead, it checks in every batch file if activatekey is same as the userinput.. if so it launches the file again but then with get_item_dsc=0 and i think it r0x0rs cuz its gonna save me alot of time and rsi :)


0

Response Number 9
Name: barteld
Date: January 22, 2004 at 17:44:13 Pacific
Reply:

oh i forgot it only checks ofcourse the batch files in the items folder so its kinda plugin system you make a new batch file and it automatically pops up in the menu :D

its really kewl to work with combining with EZmacros export to exe function etc...


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: BATCH call all files with str=1

batch to move files with same names www.computing.net/answers/programming/batch-to-move-files-with-same-names/19261.html

batch file to call reg files? www.computing.net/answers/programming/batch-file-to-call-reg-files/8298.html

batch rename files with a part of.. www.computing.net/answers/programming/batch-rename-files-with-a-part-of/16747.html