I need to create a batch file that will open cmd.exe (as a administrator) with these lines:
cd C:\Program Files\Putty
cd C:\Program Files\Putty>psftp -i XXXXXXXXX.ppk xxxx_test@111.111.111.11 -b C:\UPLOAD\upload.ftp
Can anyone help me?
I need to create a batch file that will open cmd.exe (as a administrator) with these lines:
cd C:\Program Files\Putty
cd C:\Program Files\Putty>psftp -i XXXXXXXXX.ppk xxxx_test@111.111.111.11 -b C:\UPLOAD\upload.ftp
Can anyone help me?
@echo off
runas /user:%USERDOMAIN%\%USERNAME% "cmd.exe /K \"cd C:\Program Files\Putty\" & psftp -i XXXXXXXXX.ppk xxxx_test@111.111.111.11 -b C:\UPLOAD\upload.ftp"
runas
will let you run a command as Administrator (you may need to change the domain/user to match your system, and enter a password).
Running cmd.exe /K
will run the following commands.
The quotes around the commands need to be escaped with \"
I'm having a hard time seeing the difficulty.
Can you explain what you tried, and why it didn't work?