Script opens cmn at incorrect directory 
Author Message
 Script opens cmn at incorrect directory

Quote:

> This script is OK if you run it on C:\ drive
> If you move the same script on D:\ drive
> and run it
> it opens cmd at D:\
> instead of C:\windows

> set WshShell = wscript.createObject("Wscript.Shell")
> iReturn = WshShell.Run("cmd.exe /k cd C:\windows\", 3, TRUE)

> Please help me to correct it.

Hi

set WshShell = wscript.createObject("Wscript.Shell")
iReturn = WshShell.Run("cmd.exe /k %SystemDrive% && cd %WinDir%", 3, TRUE)

' && means "Run the command following && only if the command
' preceding the symbol is successful.

--
torgeir
Microsoft MVP Scripting and WMI
Porsgrunn Norway



Mon, 18 Apr 2005 09:24:01 GMT  
 Script opens cmn at incorrect directory
This script is OK if you run it on C:\ drive
If you move the same script on D:\ drive
and run it
it opens cmd at D:\
instead of C:\windows

set WshShell = wscript.createObject("Wscript.Shell")
iReturn = WshShell.Run("cmd.exe /k cd C:\windows\", 3, TRUE)

Please help me to correct it.

Thanks
Carlos.



Mon, 18 Apr 2005 08:08:06 GMT  
 Script opens cmn at incorrect directory
cd /d %Windir% will also work...



Quote:

> > This script is OK if you run it on C:\ drive
> > If you move the same script on D:\ drive
> > and run it
> > it opens cmd at D:\
> > instead of C:\windows

> > set WshShell = wscript.createObject("Wscript.Shell")
> > iReturn = WshShell.Run("cmd.exe /k cd C:\windows\", 3, TRUE)

> > Please help me to correct it.

> Hi

> set WshShell = wscript.createObject("Wscript.Shell")
> iReturn = WshShell.Run("cmd.exe /k %SystemDrive% && cd %WinDir%", 3, TRUE)

> ' && means "Run the command following && only if the command
> ' preceding the symbol is successful.

> --
> torgeir
> Microsoft MVP Scripting and WMI
> Porsgrunn Norway



Mon, 18 Apr 2005 10:31:58 GMT  
 Script opens cmn at incorrect directory

Quote:

> cd /d %Windir% will also work...

I forget that one all the time, working to little time in the command prompt ;-)

--
torgeir
Microsoft MVP Scripting and WMI
Porsgrunn Norway



Mon, 18 Apr 2005 10:38:54 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Library Not Registered opening Active Directory Tools and .vbs scripts

2. Win32 Error 0x80040112 when executing cmn dlg box

3. need vb script to change users home directory in on fell swoop (active directory)

4. Frame open new frame depending of directory

5. opening a directory dialogbox....

6. Open Directory....What Do You Think?

7. Conditional Directory Open

8. How do I open a directory in WSH

9. Opening all files of a type in a directory

10. open directory folder window

11. open an access database and keep it open after finishing the script

12. How can I open text file for output in the same directory

 

 
Powered by phpBB® Forum Software