Answered my own questions :)
IF %CD%==%WINDIR% (
ECHO This install set cannot be run from a UNC path. Please map the share to a drive letter, or copy the installation set to a named disk.
echo Press any key to end.
Pause > nul:
... and ...
if %WRITERESULT%>0 (
echo The current disk is not writeable. Copying required files to %TEMP%\MyTempFiles ...
rd /s /q %TEMP%\MyTempFiles > nul:
xcopy /E /Q *.* %TEMP%\MyTempFiles
else (del x)
... do everything here
if %WRITERESULT%>0 (popd)
Batch script location awareness?
I just wrote this quick code snippet..@ECHO OFF
CD |SET /p DRIVE=
ECHO You are on Drive %DRIVE%
When run from any named drive, using the command line, it outputs:You are on Drive x
is the drive letter.
Unfortunately it won't run from a batch script. And even more unfortunately, batch scripts run from UNC paths hurl themselves back to C:\Windows before they start.
Does anyone know of a way of detecting whether a batch script was started from a UNC path, and what that path was?
Another useful item would be whether the current drive is read-only...?
Changing Workgroup from Command Line/Batch Script
Would anybody know how to change a computer's workgroup membership? I know it's possible to do it by doing the following (in Windows XP):
- Right-clicking My Computer
- Clicking Properties to get the System Properties window
- Tabbing to Computer Name
- Clicking the Change button to get the Computer Name Changes window
- Selecting the radio button next to Workgroup
- Typing the new workgroup name into the available text box
- Clicking OK on the Computer Name Changes window
- Clicking OK (or Apply then OK) on the System Properties window
Alternatively, I know it's possible to use the Network Identification Wizard
to set the computer's workgroup to WORKGROUP
Is it possible to do all of this from the command line (Command Prompt) or from a batch script (batch file, command script)?(Cross-posted to winxp.)
ECHO What is your name?
SET /P NAME="> "
IF "%NAME%"=="" (
ECHO Hello, %NAME%! Current Mood: contemplative