Page 1 of 1 1
Topic Options
#175682 - 2007-04-25 08:08 PM Does using Shell "cmd.exe / cd" store this in @CurDir?
danfiggolf Offline
Fresh Scripter

Registered: 2007-04-19
Posts: 5
Loc: California
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"


Edited by danfiggolf (2007-04-25 08:36 PM)
Edit Reason: additional info

Top
#175683 - 2007-04-25 08:35 PM Re: Does using Shell "cmd.exe / cd" store this in @CurDir? [Re: danfiggolf]
danfiggolf Offline
Fresh Scripter

Registered: 2007-04-19
Posts: 5
Loc: California
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


Edited by danfiggolf (2007-04-25 08:53 PM)
Edit Reason: additional info

Top
#175688 - 2007-04-25 09:22 PM Re: Does using Shell "cmd.exe / cd" store this in @CurDir? [Re: danfiggolf]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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.
_________________________
!

download KiXnet

Top
#175707 - 2007-04-26 10:37 AM Re: Does using Shell "cmd.exe / cd" store this in @CurDir? [Re: Lonkero]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
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

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 507 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.054 seconds in which 0.022 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org