Jump to content

if-statement for redirection


Recommended Posts

hey peepz,

it is possible to make an if-statement in a batch file to check if their is an D-partition to redirect My Docmunts to it?

like this:

if exist d:/

then

input regfile for redirection

NOTE: i have to partition the disk manual in XP setup, but it has only a drive letter then, no filesystem or label yet

so is it possible to check for the existance of D: and input the regfile in the registery to the desired path?

so yes, how does the if statement look like, since i'm a noob with this kind of things :blushing:

thanks in advance

Edited by scaniafreak
Link to comment
Share on other sites


Well, by your example, you would have to first format the partition. You should consider booting to a BartPE disk and running DISKPART (or scripting it). DISKPART can create all of your partitions and assign drive letters (even though these drive letters won't always be the same). You can also format these partitions in Bart PE. After that, you can pretty much run a regedit /s mydocs.reg (or whatever your reg file name is) from commandlines.txt

You could also format the 2nd partition (after creating the drive letter in DISKPART) via the commandlines.txt.

Edited by redfive19
Link to comment
Share on other sites

format d: /FS:NTFS /v:Data /q /y

You can guarantee the existence of D: if you use DISKPART prior to installing XP. I believe physical drives/partitions take letter precedence over DVD-ROM drives etc.

Are you saying that D: will not always exist on every box you roll this out on? If that's the case, you can copy over a small dummy file (say source.txt) to the root of D: and have a batch file do a search in the root directories of all drives for existence of this dummy file. There's an example in the unattended guide for how to set the variable for the CD-ROM with this method.

http://unattended.msfn.org/unattended.xp/view/web/59/

Edited by redfive19
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...