1.

Solve : Change dir to %random% named directory?

Answer»

Hello-

I have a product demo environment that I have created and want to be able to create directory STRUCTURE for demonstrating backup products.

The goal is to create a directory with a random name

md "e:\Corporate RECORDS%random%"

Result = e:\Corporate Recordsxxxx.xxxxx where x is a number between 0 and 32767

I want to be able to cd (That's change directory command for all you noobs ) to the newly created directory.

Is that possible? I only need to change directories once as I'm deleting that directory after a PERIOD of TIME, then rinse and repeat

Any assistance is appreciated.

JP

Welcome to the CH forums.

Try this:

Code: [Select]@echo off
cls

set a=Corporate Records%random%
md "e:\%a%"

e: && cd %a%


It works for me in Win.2k - please read this...

Good luckThat worked perfect.

Thank you

Windows 2003 sp2
Dell Optiplex gx280 p4 3.2 1G ramYou're welcome. Thanks for your courtesy in coming back to report success..

Good luck.Nicely Done Dusty ! !



Discussion

No Comment Found