Batch file

Rigel_Kent

New Member
Hi,

I just began to work with windows msdos. I'm trying to make a .bat file that can check if a file exists in the windows system dir.
So, I've tryed this ( don't laugh ):

Code:
IF EXIST %SystemDirectory%\filename.exe GOTO NEXT
etc...
:NEXT

The variable %SystemDirectory% doesn't even appear; only \filename.exe

Can someone help me out here?

Best regards,

Rigel_Kent
 

SFR

Truth fears no questions
Rigel_Kent said:
Hi,

I just began to work with windows msdos. I'm trying to make a .bat file that can check if a file exists in the windows system dir.
So, I've tryed this ( don't laugh ):

Code:
IF EXIST %SystemDirectory%\filename.exe GOTO NEXT
etc...
:NEXT

The variable %SystemDirectory% doesn't even appear; only \filename.exe

Can someone help me out here?

Best regards,

Rigel_Kent

I could be wrong but I think it is %systemroot% not %systemdirectory%
 

Rigel_Kent

New Member
Environment variables

Hi,

You're both right; %systemdirectory% is a value taken from a dll, it's not a msdos environment variable. I made this mistake because one article in the Net made an extreme confusion about the different env. variables that exist.
The only problem is that %systemroot% returns c:\windows when I expected c:\windows\system32.
Only %conSpec% returns something like c:\windows\system32\cmd.exe.

Meanwhile, does anyone knows how to run a batch file without the cmd window appears?

Regards,

Rigel_Kent
 

Lorand

<b>VIP Member</b>
Run the batch file with /B switch to prevent creating a window. But use this when everything is ok, since the Ctrl+C command won't work.
As for c:\windows\system32, you could use %systemroot%\system32.
 

Rigel_Kent

New Member
/B doesn't work...

Hi,

The /B does work at a certain level, but I'm trying to use it in WinRar - this app., as you know, give us the chance of running a command after unziping the files. So I call a batch file, and - look out - here comes the cmd window!

It's annoying and ugly, I would say...
Does someone has any idea how I can do this? I could make a setup in VB, but VB needs some files that the user probably doesn't have - so, it wouldn't run. It's a cycle...

Regards,

Rigel_Kent
 

Cromewell

Administrator
Staff member
I would have thought the /b would work through winrar. a simple 1 line c program: system("batch /b");
might work
 

Rigel_Kent

New Member
nop...

I had all the time that in my first line. As for the system...etc... it doesn't work - it says that it doesn't recognize the command.

Don't understand why it refuses the batch /b

Regards,

Rigel_Kent
 
Top