1.

Solve : Batch file to execute a variable?

Answer»

hope you guys can help me.....

here's a sample of what i like a batch file to do for me

cd {dir}\{folder}\{folder}
{execute a program} (dos program)

based on the executed program there is a VARIABLE (not constant)value like this:

name = 1234
name = 3456
name = 4567
name = 67890

what i would like the batch file is to get that value and there is a command to execute it, for example:

{command} 1234
{command} 3456
{command} 4567
{command} 67890

exit


this is for msXP...

thanks in advanceIf this is an example of clear, concise thinking then I fear for the future. What is driving what in this scenario? Does the name variable determine which command gets run or does the command determine which variable gets used?

Perhaps you could explain more. After you enter your batch file name, what do you see happening? Will you be passing variables along the command line or would you prefer to see a menu with the commands as options? Or would you prefer to see the name variables on the menu?

Let us know. LOLS, it just happened that i have a just a little bit of knowledge from DOS, my problems is those complex ones like this....

well, all i need is to get the value of the name var to manipulate it....in other programming languages as far as i know there is a command "get" (meaning to get the value of a variable), i know the logic but i dont know how i can do the result im thinking....

here's the full process:

i know you have heard/used of the proggy named FU Rootkit, which is a dos prog, it will display certain processes in your comp like services,system (which is not constant)... then you can hide this processes by typing a command then the value of the said process....for example: the value of services is 4 then you have to enter fu -ph 4 to hide the services process and so on...

what i want is to automate the whole process thru a batch file....is this possible? ThanksI was not familiar with this rootkit program and my research turned up pages mostly in German (I think it was German). In any case the logic is pretty much the same in any language.

Code: [Select]
set /p name=Enter Process ID
cd {dir}\{folder}\{folder}
fu -ph %name%


Hope this helps. ok, thank you very much....i know the set command will WORK here but there's something missing and i cant get the result i WANTED...

so here's a more in depth explanation for this....thanks for your patience......


Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\xxxxx>cd desktop

C:\Documents and Settings\xxxxx\Desktop>cd rootkit

C:\Documents and Settings\xxxx\Desktop\rootkit>cd fu

C:\Documents and Settings\GameZone\Desktop\rootkit\fu>fu -pl 500

Process: fu.exe:2868

Process: System:4
Process: SMSS.EXE:460
Process: CSRSS.EXE:516
Process:
Process: SERVICES.EXE:584
Process: LSASS.EXE:596
Process:
Process:
Process:
Process:
Process:
Process:
Process: cmd.exe:1616


all i need is the number on the right next to the process id....example 4,460,516......(but this numbers are NOT constant, it changes everytime the whole process is repeated)

on my batch file i can only go this far, displaying this...the next procedure should be to type

c:\\\fu -ph 4
then
c:\\\fu -ph 460
then
c:\\\fu -ph 516

then when all is inputed will just exit the cmd....


it looks simple but im having a hard time because of the value of process id is variable....what should i do??? is it possible to do this in DOS or it needs some other prog languages?....thanksoh, by the way.... it should not have user inputs...it shoud only be based on the command fu -pl

thanks againNo user input. Hmmm.

Code: [Select]
@echo off
cd \desktop\rootkit\fu
for /F "tokens=1-3 delims=:" %%a in ('fu -pl 500') do (
if %%c GEQ 1 fu -ph %%c
)


If the PIDs are moving targets this may produce unpredictable results.

Good luck. This may or may not help, but I was troubled for MANY hours with a returned variable not being as expected, my solution was the to include commands:

setlocal enabledelayedexpansion

if defined RTV2 echo RTV2 is defined as !RTV2!

endlocal

I hope this is of help.



Discussion

No Comment Found