danfiggolf
(Fresh Scripter)
2007-04-25 08:08 PM
Does using Shell "cmd.exe / cd" store this in @CurDir?

What I need to do is place the directory I CD into in a variable I can call elsewhere. What's happening is @CurDir is the same as @StartDir.

1) cd to a directory like below [this works fine].
Shell "cmd.exe /c cd %userprofile%\.."

2) make a directory in the above directory path, versus it going into the directory path of the scrip?.
MD "WDrive\" + TestDir

3) save this new directory path in a Variable $WDrive, where @CurDir is the directory I changed to in number 1 above?
$WDrive=@CurDir + "\WDrive\" + $UserDir

Does using Shell "cmd.exe / cd" store this in @CurDir?
Thanks in advance. Danfiggolf
CODE Below

; -----
; My Kixtart Script
; -----

; create a new WDrive at the Documents and Settings directory level.
Shell "cmd.exe /c cd %userprofile%\.."
$UserDir=@userid + "$$";
MD "WDrive\" + $UserDir
$WDrive=@CurDir + "\WDrive\" + $UserDir

; set permissions full control user and administrator
Shell "cmd.exe /c echo y| cacls $WDrive" + "/t /g " + @userid + ":F"
Shell "cmd.exe /c echo y| cacls $WDrive" + "/e /t /g administrator:F"

; mount virtual WDrive to the new storage area
Shell "cmd.exe /c subst W: /D"
Shell "cmd.exe /c subst.exe w: $WDrive"


danfiggolf
(Fresh Scripter)
2007-04-25 08:35 PM
Re: Does using Shell "cmd.exe / cd" store this in @CurDir?

What I need to do is place the directory I CD into in a variable I can call elsewhere. What happening is @CurDir is the same as @StartDir.

As well, I've tried -

Shell "cmd.exe /c cd %userprofile%\.." > $NewDir


LonkeroAdministrator
(KiX Master Guru)
2007-04-25 09:22 PM
Re: Does using Shell "cmd.exe / cd" store this in @CurDir?

you use cmd.exe.
the directory is only changed in that environment and resetted when the exe exits.

what you actually want, is to use kixtart internal cd command.


Richard H.Administrator
(KiX Supporter)
2007-04-26 10:37 AM
Re: Does using Shell "cmd.exe / cd" store this in @CurDir?

Why CD at all?

 Code:
; -----
; My Kixtart Script
; -----

; create a new WDrive at the Documents and Settings directory level.
$WDrive=%USERPROFILE%+"\WDrive\"+@USERID+"$$"
MD $WDrive

; set permissions full control user and administrator
Shell "cmd.exe /c echo y| cacls "+$WDrive+" /t /g "+@USERID+":F"
Shell "cmd.exe /c echo y| cacls "+$WDrive+" /e /t /g administrator:F"

; mount virtual WDrive to the new storage area
Shell "cmd.exe /c subst W: /D"
Shell "cmd.exe /c subst.exe w: "+$WDrive