
Pc SPEC:
Current OS WinXPSP3 working within CMD.EXE & I have also tried to use Command.com from CMD window. PC is Small-Form Factor Intel core i7 vPro with 8 gig ram usb non-wireless mouse setup on dual boot "grub for dos" non-bootsector dual boot mechanism with Q4OS Linux OS. I have portable Vbox installed off usb drive with Win98SE & ME
- I have tried googling for a similar problem without much luck
- I have not yet tried within W98SE Vbox but first it needs to work within XP first (possibly Win3.1?)
- I have tried to examine the script with echo on instead of echo off
- I have tried to break the script down into stages & stopped the script from deleting the temp files it makes to see what is within these temp bat files.
- Have tried to echo the variable upon completion to see if it is defined & the answer is no
Can someone shed some light on what I am doing wrong with a small elementary batch script that I am trying to compile. I'm sure it is something simple that I am missing & will KICK myself when I discover what but the problem has got me confounded.
The batch script (IF possible needs to work in XP as well as Win98SE [& a luxury would be Win3.1]) Here is the batch script with comments to try to explain what I am trying to do with the script?
@ECHO ON (Used to see whats going on with the batch script will @echo off when fixed)
SET DRV= (Used to clear any previous Drive: Vars so starting from fresh each time)
ECO.COM SET DRV=>T1.BAT (ECO.COM is a debug echo script that permits not having CRLF)
ECHO PROMPT $N:>T2.BAT ($N: is a Prompt for Drive: not $p$g standard prompt redirected to T2 temp bat
COPY T1.BAT+T2.BAT T3.BAT>NUL (Joins 2No temp bats to form third temp bat with copy)
CALL T3.BAT (Calls T3 temp bat with one line of SET code)
:: DEL T?.BAT (Deletes all three temp bats to cleanup)
ECHO Your Current Drive is %DRV% Tests if the variable is defined the answer is no)
pause (Pause is used to retain info on the screen when script completes)
T1.BAT has the following text therein SET DRV=
T2.BAT has the following text therein PROMPT $N:
T3.BAT lastly has this text before being called SET DRV=PROMPT $N:
Is the newline carriage return square box thingy on next line
Within the CMD window I get the following text:
Your Current Drive is <Nothing>
Press any key to continue . . . <cursor>
What this script is supposed to do is get the Drive: prompt into a variable e.g. "C:" (without quotes) but it ain't happening at my end? Some help would be appreciated, thanks in advance
P.S. Oh by the way & as feedback in respect of "How to get help for a batch script - quickly!" the links within the post do not work for me I am using Palemoon which is firefox browser on XP. Could someone check to see if its just me with my browser or are the links not going anywhere?
P.S2 - I have tried to establish this script from the command prompt. If for instance I type at the command prompt "PROMPT $N:" & hit the <ENTER> key this works manually typing it in manually however within batch it is failing, any ideas Please? I have also tried Echoing prompt & using a key-stuffer to simulate the <ENTER> but again this fails?
Regards
ispy