1.

Solve : Issue with Replacable Parameters?

Answer»

The batch below is one for a school assignment.

@echo off

echo On %DATE% at %TIME% the %1% drive on the %computername% computer has:
dir |find "bytes free"

Upon execution, everything runs fine.

The only issue I have is with first line at %1%. After that none of my other text APPEARS, except the %COMPUTERNAME% which executes as "COMPUTERNAME".

I'm guessing there is an issue with the %1%, I'd appreciate the help. @echo off
rem Author: Meagan Parsons
rem Date: 2/10/2011
rem Name: freespace.bat
rem Purpose:

echo On %DATE% at %TIME% the %1% drive on echo the
echo %COMPUTERNAME% computer has

dir |find "bytes free"

I changed it up a bit and GOT all my INFORMATION to display. But I'd REALLY like to have the first two lines on 1 line. Is there a limit to the # of parameters/variables I can have on 1 line?
This may help:

Code: [Select]@echo off
for /f "tokens=3" %%i in ('dir %1 ^| find /i "bytes free"') do (
echo On %DATE% at %TIME% the %1 drive on %COMPUTERNAME% computer has %%i bytes free
)

Pass the drive LETTER on the command line. ( Ex. scriptname c: )

Good luck.
Quote from: mparsons12 on February 10, 2011, 07:24:36 AM

I'm guessing there is an issue with the %1%, I'd appreciate the help.

Replaceable parameters only have ONE percent sign, preceding the digit, e.g. %1


Discussion

No Comment Found