?

Log in

Batch Scripting
 
[Most Recent Entries] [Calendar View] [Friends]

Below are the 6 most recent journal entries recorded in Batch Scripting's LiveJournal:

Wednesday, January 14th, 2009
10:36 am
[madkatsjournal]
Answered my own questions :)


IF %CD%==%WINDIR% (
echo.
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.
echo Press any key to end.
Pause > nul:
goto Abort
)
:Abort


... and ...


echo. >x
SET WRITERESULT=%ERRORLEVEL%

if %WRITERESULT%>0 (
echo The current disk is not writeable. Copying required files to %TEMP%\MyTempFiles ...
rd /s /q %TEMP%\MyTempFiles > nul:
del %TEMP%\MyTempFiles
md %TEMP%\MyTempFiles
xcopy /E /Q *.* %TEMP%\MyTempFiles
pushd %TEMP%\MyTempFiles
)
else (del x)
...
... do everything here
...
if %WRITERESULT%>0 (popd)
10:01 am
[madkatsjournal]
Batch script location awareness?
I just wrote this quick code snippet..

@ECHO OFF
PUSHD\
CD |SET /p DRIVE=
ECHO You are on Drive %DRIVE%
POPD


When run from any named drive, using the command line, it outputs:
You are on Drive x

where 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...?
Saturday, March 29th, 2008
3:02 pm
[gacsyt]
precious moment figurines for sale
http://pics.livejournal.com/manage/pics?gal=5 

hi i am selling precious moments figurines. check out the link above. :) interested parties can email to me in LJ or to my email: eclair_gem@hotmail.com 

thanks

caudia
Friday, June 17th, 2005
3:25 pm
[cparker]
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):
  1. Right-clicking My Computer
  2. Clicking Properties to get the System Properties window
  3. Tabbing to Computer Name
  4. Clicking the Change button to get the Computer Name Changes window
  5. Selecting the radio button next to Workgroup
  6. Typing the new workgroup name into the available text box
  7. Clicking OK on the Computer Name Changes window
  8. 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.)
Tuesday, June 7th, 2005
5:41 pm
[cparker]
Pseudo split() Command
To start this community off, I'm including a reference of a nifty feature of SET that allows you to mimic the very basics of UNIX's split() command.

You can find the question I asked--and a perfect answer--in shell_scripting: http://www.livejournal.com/community/shell_scripting/4371.html

Typing "help set" at the command line gives you this output.Collapse )
3:38 pm
[cparker]
First Post
@ECHO OFF
SET DEFAULT=world
SET NAME=

CLS
ECHO.

ECHO What is your name?
SET /P NAME="> "

IF "%NAME%"=="" (
SET NAME=%DEFAULT%
)

ECHO Hello, %NAME%!

Current Mood: contemplative
Google Search ["batch scripting"]   About LiveJournal.com