Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 300
  • Last Modified:

.bat Problem

Hi Experts,
For a batch file, is it possible to
(1.) set it up to run at a regular time? say, on a weekly or monthly basis?
(2.) embed username and password inside in order to connect or login onto another server/account?

If it is, then how to do them?

Thanks for all replies.  
0
davidw88
Asked:
davidw88
  • 4
  • 3
1 Solution
 
SteveGTRCommented:
You can schedule a task to run a batch file and run it like so:

cmd /c c:\dir\yourbatch.bat

When c:\dir\yourbatch.bat is the fully qualified batch file name.

You can access a network resource by mapping to a share:

net use z: \\server\share\dir password /user:username

0
 
SteveGTRCommented:
A more secure method would be to set the Run as to the domain user account that has access to the network resource. This would be specified in the task scheduler and would protect the user account. Rather than hard coding the username and password in the batch file where others might be able to read it.

Then you'd simply reference the network resource using a UNC:

\\server\share\dir

Or do net use, but without specifying the user account information. Since the task is run as the domain user account.
0
 
davidw88Author Commented:
Hi SteveGTR,
Thanks so much for your reply. The account that I want to access is an online account. How to create a network share drive on my local machine for this URL?

The URL is "https://files.rrr.net". I followed the "Add Network Place Wizard" to create a network drive. I put the URL as the "Internet or network address" but the system said that "The folder you entered does not appear to be valid. Please choose another."

How to handle this?
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
SteveGTRCommented:
I don't know if that's possible from the DOS prompt. It sounds like you are connecting to the server via HTTP through IE.
0
 
davidw88Author Commented:
Hi SteveGTR: Thanks for your reply again. Here is what I am trying to do.  

I use  a Webdav client Bitkinex to copy data from source ("https://files.rrr.net/webdav") to my local machine ("c:\local\data").

The .bat file is
"c:\bitkinex.exe" cp  https://files.rrr.net/webdav c:\local\data

The source data is located on "https://files.rrr.net/webdav". When the .bat file is executed, it pops up a user name/password interface to require login for the "https://files.rrr.net/webdav".

In this case is it possible to avoid the login prompt?

0
 
SteveGTRCommented:
I know you can do this with ftp from IE, but you could give it a try:

Uniform Resource Identifier in one of the following forms:

   1. Standard URI:
      [protocol]://{[user]{:[password]}@}[server]{/[path]}

      Example: ftp://john:mypasswd@www.myserver.com/private/john/
      Note: Paths ending with a slash are treated as directories.
0
 
davidw88Author Commented:
Thanks a lot. I will give that a try.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now