1.

Solve : SETTING A VARIABLE THROUGHOUT ENTIRE CODE..???

Answer»

THIS IS MY CODE:

Code: [Select]SET DRIVE=D
IF NOT EXIST %DRIVE%:\ GOTO %DRIVE%-SKIP
START CALC
:%DRIVE%-SKIP

BUT THIS IS WHAT I GET AS RESULTS IN A CMD WINDOW:

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

C:\Documents and Settings\VM-WARE>"C:\Documents and Settings\VM-WARE\Desktop\1.BAT"

C:\Documents and Settings\VM-WARE>SET DRIVE=D

C:\Documents and Settings\VM-WARE>IF NOT EXIST D:\ GOTO D-SKIP
The system cannot find the batch label specified - D-SKIP

C:\Documents and Settings\VM-WARE>

SO HOW CAN I MAKE IT SEE THE :%DRIVE%-SKIP BY STILL KEEPING THE %DRIVE% VARIABLE..??Gumbaz, is there a caps lock key on your KEYBOARD?

You cannot make a label out of a variable. It cannot be done. Batch language does not support self-modifying code! Nice try though





Discussion

No Comment Found