I need some help with batch file. I am using windows 7.
I need a batch file to:
Open VPN Client on my PC, path is
("C:\Program Files (x86)\Cisco Systems\VPN Client\vpngui.exe)
There are 5 VPNs in the list. Connect to vpn name (AA_VPN) using my username and password
A window pop ups when I connect - that is 'continue or discontinue'
3. The process should press 'continue' button or spacebar key (all works)
And then the batch file should close itself.
Thanks.
From documentation:
"C:\Program Files (x86)\Cisco Systems\VPN Client\vpnclient" connect AA_VPN user <yourUser> pwd <yourPassword>
Related
is it possible to make a bat file that waits for a remote command that is cross-domain? that way I can set up a bat file on my computer at home that clicks accept (for chrome remote desktop) when I send the remote command.
im new with .bat files.
Im trying to create a .bat file that backups files from a PC to a server PC that is not in the same network.
In this case, i can connect to the server pc with my home pc with remote desktop (got the IP, domani username and password), and i want to make a batch file that sends files from my house pc, to the server pc in my job.
Is there any type of way to send them?
This is what i tried so far:
PROGRAM 1:
copy C:\FROM_HERE \\xxx.xxx.xxx.xx\C:\TO_HERE
net use \\xxx.xxx.xxx.xx\C:\TO_HERE /user:username password
robocopy \xxx.xxx.xxx.xx\C:\TO_HERE C:\FROM_HERE
net use /delete
pause
This program says that the route cannot be found.
I dont know, any suggestion please?
I am creating a batch file to open a RDP session.
The remote desktop uses a gateway, so there are 2 credentials to be entered.
One for the gateway and other for the remote desktop.
I have written the following code:-
cmdkey /generic:gateway/abc.com /user:user1 /pass:password1
cmdkey /generic:TREMSRV/10.2.13.4 /user:user2 /pass:password2
start mstsc /v:10.2.13.4
But on running this code the pop to enter first set of credentials appears. I want to hardcode the credentials in the batch file itself
Can anyone suggest how shall i accomplish this ?
As just extra protection, I am wanting to backup remote sql db to my location nightly. There is no VPN so...
I created a user on the 2008 db server for the sole purpose to log on from my office and download the db bak file nightly. Gave this user read permission on the backup directory (T:\Backup) and added to the remote users group.
I created a Automated task on my workstation that calls a rdp file that successfully connects to the db server as this user.
The rdp file specifies in the "Start a program" tab the following path:
C:\Windows\System32\mstsc.exe T:\Backup\copydb.bat
I have tested both parts:
1) Double-clicking the rdp file will login automatically. (WORKS)
2) I can then manualy open the dos prompt and run the bat file. (WORKS)
However, the bat file does not seem to execute on connection . There is no cmd window. I can douple-click on the bat file and the cmd window will flash and go away but does not execute. The only way I've been able to get it to execute is to open the prompt and then the file.
I thought that's what this would do:
C:\Windows\System32\mstsc.exe T:\Backup\copydb.bat
What am I missing?
This might be your problem.
Refer to this MS support article You cannot create a terminal server session to a Windows Server 2008-based computer by using an .rdp file that runs an initial program
To work around this problem, add the program path to the RemoteApp Programs list. To do this, follow these steps:
Click Start, click Run, type remoteprograms.msc, and then click OK.
In the actions pane, click Add RemoteApp Programs, and then click Next.
Click Browse, locate the program that you want to approve, click Next, and then click Finish.
I am currently writing a script that calls WinSCP, connects an SFTP session, transfers a group of files from a local server to a remote server, closes the connection, then moves the local file to an archive. An alternate acceptable solution would be to copy the file to archive and then delete it from the source directory.
The problem I am having is that I can get WinSCP to open, connect and transfer the files, but after that the commands are ignored and I am unable to automate the connection close, file move or copy and the deletion and closing of command prompt. What is the best way to do this?
My FTP.bat file that connects the session and calls the script -
"C:\Program Files\WinSCP\WinSCP.exe" /console /command "lcd d:\bofa_ftp\out" /script=script.txt savedsession#winscpname.com
My script file that puts the file and closes the connection -
option batch abort
option confirm off
option exclude script.txt
put *.txt
close
When I add any commands to either the bat or the script they are ignored.
Commands after close are definitely not ignored. Your problem might be that you are trying to put Windows commands to WinSCP script. Note that there are no commands in WinSCP to move local files.
Instead of trying using Winscp3, try with plink.exe.
Plink is the best option to transfer files from winscp3 to your local.By using scp command we can transfer file from winscp to local as well as one folder in to another folder in winscp.
scp username#atechguideserver1.com:/data/tmp/samplscp.txt username#atechguideserver2.com:/data/tmp/dir/tech
Please refer to: http://99students.com/move-files-in-unix/