Avatar of WilsonJ
WilsonJ
Flag 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\"
ProgrammingWindows 7

Avatar of undefined
Last Comment
WilsonJ

8/22/2022 - Mon
Frosty555

If you're getting access denied errors... maybe you just need to run the script as Administrator?
JonLambert

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.
Martin_J_Parker

Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Martin_J_Parker

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
Martin_J_Parker

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
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
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.