WilsonJ
asked on
Batch Script For Windows 7
Hello Experts,
I need your help,
I have two Scripts i use to retrieve and deposit files into our ftp. the scripts work like a champ in XP but now i must update to windows 7 and they no longer work. it gives an "Access File Denied" error.
Here are the scripts i use. What do i need to modify in the scripts or Windows 7 security to allow me to use it.
Thank you in advance.
Wilson J
Receive Update
echo off
del c:\ftp.txt
echo username>> c:\ftp.txt
echo password>> c:\ftp.txt
echo prompt off >> c:\ftp.txt
echo lcd "c:\RIFolder\" >> c:\ftp.txt
echo get "SFolder\RIFolder\filename .XLT" >> c:\ftp.txt
echo get "SFolder\RIFolder\\filenam e.txt" >> c:\ftp.txt
echo bye >> c:\ftp.txt
ftp -s:c:\ftp.txt ftp.domainname.com
del c:\ftp.txt
Send Update
echo off
del c:\ftp.txt
echo username>> c:\ftp.txt
echo password>> c:\ftp.txt
echo prompt off >> c:\ftp.txt
echo mput "c:\RIFolder\import\*.csv" >> c:\ftp.txt
echo bye >> c:\ftp.txt
ftp -s:c:\ftp.txt ftp.domainname.com
del c:\ftp.txt
echo off
echo off
cd "c:\RI\import"
move /y *.csv "c:\RIFolder\import\backup \"
I need your help,
I have two Scripts i use to retrieve and deposit files into our ftp. the scripts work like a champ in XP but now i must update to windows 7 and they no longer work. it gives an "Access File Denied" error.
Here are the scripts i use. What do i need to modify in the scripts or Windows 7 security to allow me to use it.
Thank you in advance.
Wilson J
Receive Update
echo off
del c:\ftp.txt
echo username>> c:\ftp.txt
echo password>> c:\ftp.txt
echo prompt off >> c:\ftp.txt
echo lcd "c:\RIFolder\" >> c:\ftp.txt
echo get "SFolder\RIFolder\filename
echo get "SFolder\RIFolder\\filenam
echo bye >> c:\ftp.txt
ftp -s:c:\ftp.txt ftp.domainname.com
del c:\ftp.txt
Send Update
echo off
del c:\ftp.txt
echo username>> c:\ftp.txt
echo password>> c:\ftp.txt
echo prompt off >> c:\ftp.txt
echo mput "c:\RIFolder\import\*.csv"
echo bye >> c:\ftp.txt
ftp -s:c:\ftp.txt ftp.domainname.com
del c:\ftp.txt
echo off
echo off
cd "c:\RI\import"
move /y *.csv "c:\RIFolder\import\backup
If you're getting access denied errors... maybe you just need to run the script as Administrator?
Either run the script from an elevated command prompt (i.e. Run as Administrator) or change the permissions on the C:\RIFolder to allow standard users to access it. By default standard users will not have access to write to a folder off the root of C:\ in Windows 7.
You could use a VB script to run the batch file with elevated (effectively Admin) privileges:
http://www.winhelponline.com/articles/185/1/VBScripts-and-UAC-elevation.html
This old thread might help:
https://www.experts-exchange.com/questions/23462188/Run-elevated-batch-files-in-Vista-directly-by-executing-them.html
http://www.winhelponline.com/articles/185/1/VBScripts-and-UAC-elevation.html
This old thread might help:
https://www.experts-exchange.com/questions/23462188/Run-elevated-batch-files-in-Vista-directly-by-executing-them.html
More info about elevating permissions here:
http://4sysops.com/archives/vista%E2%80%99s-uac-8-ways-how-to-elevate-an-application-to-run-it-with-administrator-rights/
http://4sysops.com/archives/vista%E2%80%99s-uac-8-ways-how-to-elevate-an-application-to-run-it-with-administrator-rights/
ASKER
Thank you for your responses,
The users have local Admin rights on their laptops. so i dont think it is an issue with permissions, it looks to me that there is something wrong with the systax but i have not change anything the script/batch works fine on XP
This is what i'm getting now that i disabled UAC and added the user name to the folder with full control
C:\Remote Inventory>receiveupdate
C:\Remote Inventory>echo off
Transfers files to and from a computer running an FTP server service
(sometimes called a daemon). Ftp can be used interactively.
FTP [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-A] [-x:sendbuffer] [-r:recvbuf
fer] [-b:asyncbuffers] [-w:windowsize] [host]
-v Suppresses display of remote server responses.
-n Suppresses auto-login upon initial connection.
-i Turns off interactive prompting during multiple file
transfers.
-d Enables debugging.
-g Disables filename globbing (see GLOB command).
-s:filename Specifies a text file containing FTP commands; the
commands will automatically run after FTP starts.
-a Use any local interface when binding data connection.
-A login as anonymous.
-x:send sockbuf Overrides the default SO_SNDBUF size of 8192.
-r:recv sockbuf Overrides the default SO_RCVBUF size of 8192.
-b:async count Overrides the default async count of 3
-w:windowsize Overrides the default transfer buffer size of 65535.
host Specifies the host name or IP address of the remote
host to connect to.
Notes:
- mget and mput commands take y/n/q for yes/no/quit.
- Use Control-C to abort commands.
The system cannot find the file specified.
The users have local Admin rights on their laptops. so i dont think it is an issue with permissions, it looks to me that there is something wrong with the systax but i have not change anything the script/batch works fine on XP
This is what i'm getting now that i disabled UAC and added the user name to the folder with full control
C:\Remote Inventory>receiveupdate
C:\Remote Inventory>echo off
Transfers files to and from a computer running an FTP server service
(sometimes called a daemon). Ftp can be used interactively.
FTP [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-A] [-x:sendbuffer] [-r:recvbuf
fer] [-b:asyncbuffers] [-w:windowsize] [host]
-v Suppresses display of remote server responses.
-n Suppresses auto-login upon initial connection.
-i Turns off interactive prompting during multiple file
transfers.
-d Enables debugging.
-g Disables filename globbing (see GLOB command).
-s:filename Specifies a text file containing FTP commands; the
commands will automatically run after FTP starts.
-a Use any local interface when binding data connection.
-A login as anonymous.
-x:send sockbuf Overrides the default SO_SNDBUF size of 8192.
-r:recv sockbuf Overrides the default SO_RCVBUF size of 8192.
-b:async count Overrides the default async count of 3
-w:windowsize Overrides the default transfer buffer size of 65535.
host Specifies the host name or IP address of the remote
host to connect to.
Notes:
- mget and mput commands take y/n/q for yes/no/quit.
- Use Control-C to abort commands.
The system cannot find the file specified.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much Martin,
Apparently Windows 7 doesn't like the spaces in the folder or file names. I dont know what is the rule under XP but i think that as long as you are going one level under the root you can get to the file or folder without using the "file name" all i did was to put " " in any of the folder and file name and BINGO it works.
Again thank you very much,
WilsonJ
Apparently Windows 7 doesn't like the spaces in the folder or file names. I dont know what is the rule under XP but i think that as long as you are going one level under the root you can get to the file or folder without using the "file name" all i did was to put " " in any of the folder and file name and BINGO it works.
Again thank you very much,
WilsonJ