Change the DOS prompt default directory (1 Viewer)

ajetrumpet

Banned
Local time
Yesterday, 18:51
Joined
Jun 22, 2007
Messages
5,638
Hello all,

I have this code that opens my domain through DOS:
PHP:
Function test()

Dim vPath As String
Dim vFTPServ As String
Dim fNum As Long
Dim directory As String

vPath = "c:"
vFTPServ = "www.mydomain.com"

'Mounting file command for ftp.exe
fNum = FreeFile()
Open vPath & "\FtpMyDomain.txt" For Output As #fNum
Print #1, "USER UserName" ' your login
Print #1, "Password" ' your password

directory = InputBox("Which directory would you like?", "Directory")

If directory = "1" Or _
   directory = "2" Or _
   directory = "3" Or _
   directory = "4" Then
      Print #1, "cd " & directory
End If

Print #1, "dir"
Close

Shell "ftp -n -i -g -s:" & vPath & "\FtpMyDomain.txt " & vFTPServ, vbNormalFocus

End Function
this is just like opening the command prompt and typing in FTP instead of CMD. The problem I am having is that my default directory for DOS is c/users/ajetrumpet/documents. as in, when I GET a file from the server after opening the above DOS prompt, it automatically downloads it to the directory I named above. What I would like is for it to download to my desktop directory. I have tried going to properties of the DOS prompt menu item and changing the "START IN" to the dir that I want, but that does not cover the above function. And it also doesn't cover it when I go to the DOS prompt from the windows menu and simply type CMD in the line. It only works with the shortcut icon.

Has anyone ever done this before and if so, do you have any advice? Thanks!
 

ajetrumpet

Banned
Local time
Yesterday, 18:51
Joined
Jun 22, 2007
Messages
5,638

thanks bud, but I don't have enough registry experience to mess with this. i had already seen that webpage too and tried it, but I don't have an autorun folder in my registry on my vista machines, so I didn't really want to mess with it. if you have an easier suggestion, i'm all ears. or, if you know how to make keys without messing it up, that would be great to know!
 

chergh

blah
Local time
Today, 00:51
Joined
Jun 15, 2004
Messages
1,414
It's not to tricky. Navigate to the location on that page. To create the autorun value right click on the right hand pane and from the pop up menu it's new> String Value

Rename what you have created to "Autorun" then right click on it and choose modify. In the "Value Data" box put "CD /d C:\foo" where C:\foo is the path where you want to start.

You can backup your registry as well just to be on the safe side but you can't go to far wrong with this.
 

Users who are viewing this thread

Top Bottom