Link to home
Create AccountLog in
Avatar of WilsonJ
WilsonJFlag for United States of America

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\\filename.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\"
Avatar of Frosty555
Frosty555
Flag of Canada image

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.
Avatar of WilsonJ

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.
ASKER CERTIFIED SOLUTION
Avatar of Martin_J_Parker
Martin_J_Parker
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of WilsonJ

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