I want to make a simple batch file - file

that opens Minecraft.exe, and logs in when clicked. Is this possible?

Hmm, Is this what you want; it should work:
#echo off
"%cd%\minecraft.exe" username password serverip
edit the username, password and ip to your liking.
A Better Solution in my opinion:
Just figured it out, the batch file doesn't work, however; when set up as a shortcut it does! So create a new shortcut and for the path use this:
Format:
"<FilePath>" <username> <password> <server>
Example:
"C:\Program Files\Minecraft\Minecraft.exe" bobjones passchuck 123.123.123.123
Hope that works out for you, alot simpler then a bath file IMO.
also if you don't include IP, it just goes and logins in to minecraft. Stopping at the title screen.

http://www.minecraftwiki.net/wiki/Tutorials/Setting_up_a_server#Start_the_Minecraft_Server_.28.jar_version.29
To start the jar version of Minecraft on Windows, create a new file in Notepad, and paste in
java -Xms512M -Xmx1G -jar minecraft_server.jar
Save the file as startserver.bat, and place the file in the same folder as minecraft_server.jar. The .bat extension saves the file as a batch file.

Related

Writing secure batch files

I have a simple batch file:
#echo off
set username=user
set password=pass
::do some things with the username and password
the user could just call the batch file from cmd, and type set after my batch file has run it's course and see the username and password.
Is there any way to fix this?
(excluding bat to exe converters)
Prompt for password then save it
This script here to use the password associated with a batch file from a hidden stream attached to the file, prompt for the password if not present and save it. If you know how to work out what is going on in the batch you could do the same and get the password to work with, but to a casual observer it is not at all obvious how it works.
Password entry obscured from batch file
Script to prompt for and enter password in hidden manner.
Password hidden using ADS
Script to store password in an extra data stream with the batch file that you can't see but is there and can be read by the batch file itself.

BAT file programming assistance : how to make a response in a bat file copy to another part OR to clipboard?

My apologies if the title was confusing. It should be fairly basic, but I cannot find a way to do this.
What i'm wanting to do is have a bat file prompt for an answer to a question and then surround that answer with another piece of code and either copy to the clipboard or after the connection.
Maybe it will make more sense if i give the code.
#echo off
set /p input ="what server would you like to connect to? (example srv02) :"
echo Myhome.%input%.com
pause
c:\program files\putty
the echo gives the correct response, but i would like to see if there is a way to paste this past the c:\program files\putty to connect to a server.
OR if there is a way to copy that response to the clipboard so the bat file would open putty (which it does now) and then you could just paste that response.
Or am i going about this the wrong way? thanks for the help!!
I'm not a PuTTY user, so I can't be sure - But I believe you are simply trying to pass the the server host that you want to connect to. I think the following will do what you asked:
"c:\program files\putty" %input%
or
"c:\program files\putty" Myhome.%input%.com
However, there are probably other command line options you need to really accomplish your goal.
You should learn the PuTTY command line arguments and options. I suspect a web search could find some tutorials or examples to get you started.
Perfect! That is what i ended up doing after a few more hours of research.
I came up with two different types of scripts as my company wants us to use a specific set of defaults for different servers.
#echo off
set /p input="what server would you like to connect to? : "
echo myhome.%input%.com| clip
echo ----
echo myhome.%input%.com has been copied to your clipboard,
echo you can now paste into the host name box in putty
echo -----
echo Press enter to open puTTY
echo -----
Pause
start c:\users\public\apps\putty.exe
Ended setting it to open putty instead of pasting because it should be defaulted settings, but not everyone kept it that way, of course.
Thanks for the assistance though!

auto schedule upload using batch file and command prompt

I am trying to use a cmd file to run a batch file that uploads a file of mine to a directory of my website. The batch file looks like this:
open ip address
username
password
option confirm off
cd \public_html\wp-content\uploads\2014\07
put "C:\Users\a\Documents\pdf\Contact Info.pdf"
quit
The cmd file looks like this:
ftp -s:c:\Users\a\Documents\upload.bat
When I run the cmd file I get output in command prompt that says that my username and password are ok and then tells me that option confirm off is an invalid command and that the cd filepath is a prohibited file name. It then says my file is uploaded but I can't find where the file is put. Is there a reason why this is happening? Is it possible to upload the file to that directory?
Use winscp. Download: http://winscp.net/eng/download.php
option confirm off is a valid WinSCP command, see http://winscp.net/eng/docs/scriptcommand_option
Example: Uploading a single file with WinSCP
http://winscp.net/eng/docs/script_upload_single_file
Step 1
create file: winscp-upload-script.txt
option batch abort
option confirm off
open sftp://username:password#example.com/
put "C:\Users\a\Documents\pdf\Contact Info.pdf" \public_html\wp-content\uploads\2014\07
exit
Step 2
create file: do-upload.bat
"C:\Program Files (x86)\WinSCP\winscp.com" /script=winscp-upload-script.txt
Step 3
Go scheduler, create new task, like described here (http://www.sevenforums.com/tutorials/12444-task-scheduler-create-new-task.html) and use do-upload.bat and configure event timing.
-Done-

How to create batch file?

I need to run the below command from command prompt. How do i make it a batch file so that I do not have to type the whole command again?
c:\program files (x86)\microsoft ajax Minifier\ajaxmin.exe c:\css\reset.css c:\css\main-styles.css c:\css\lightbox.css c:\css\shortcodes.css c:\css\custom-fonts.css c:\css\custom-colors.css c:\css\admin_menu.min.css -out c:\css\mc.css -clobber
Add the >"file.bat" echo to the start of the command to create a simple batch file.
Quotes around paths and filenames with spaces and & characters are needed too.
>"file.bat" echo "c:\program files (x86)\microsoft ajax Minifier\ajaxmin.exe" c:\css\reset.css c:\css\main-styles.css c:\css\lightbox.css c:\css\shortcodes.css c:\css\custom-fonts.css c:\css\custom-colors.css c:\css\admin_menu.min.css -out c:\css\mc.css -clobber
In some cases certain characters will need escaping but for your example it will work.
Just create a new file with a .bat extension and copy these lines into it.
Then you can run it by double clicking it in Windows explorer or by typing its name in cmd prompt.
There are many ways, by the looks of it you are already running that command from a command prompt, you can write the command to a batch file like this:
echo <command> > mycommand.bat
So:
echo ajaxmin.exe c:\css\reset.css c:\css\main-styles.css c:\css\lightbox.css c:\css\shortcodes.css c:\css\custom-fonts.css c:\css\custom-colors.css c:\css\admin_menu.min.css -out c:\css\mc.css -clobber > mycommand.bat
You can also type the command into notepad or other text editor and save with a .bat extension instead of .txt.
How to create a Batch file:
Right click on your desktop or whereever you want it to
Click new text document
Rename it
Open it in notepad or whatever you want, and now you have a batch file!

Installing exe through batch file

I am trying to install through batch file..
ECHO OFF
ECHO Installing MySoftware . . .
"%~dp0\MySoftware.exe" /S /v/qn"UPGRADEADD=link goes here"
pause
but it fails to install.
Not much info to go on. What you have will not work if executed from a UNC drive and may not work if you 'Run as administrator' because the current directory gets changed. Try this. Of course that may not fix it and further details would be nice.
#ECHO OFF
PUSHD "%~dp0"
ECHO Installing MySoftware . . .
"MySoftware.exe" /S /v/qn"UPGRADEADD=link goes here"
Adding to my answer based on comments provided.
Presumably your bat file is in the same folder as MySoftware.exe. If it takes that long, it sounds like the install is working. Try doing
"MySoftware.exe" /?
That may give you a help screen to tell you more about the arguments beng passed. Also, try what you are now doing without the /S (which probably specifies a "silent" install... which is why you don't see anything.
PART 1 - If you want to create a "Setup" File in batch.
Maybe it works, but this is will be very hard to you for done this program.
Let's call the EXE File "Game1:
I will recommend you to take all the Game1 file's code (Maybe you can use the program Notepad++ for do this) after you taked Game1's code do this like i writing here
Let's say that the code of Game1 is:
ABC
Copy the code, then go to the batch file.
The "Setup" file of Game1 HAVE to come with a empty EXE file.
You can make a empty EXE file with notepad - just save the file as:
Name.exe
Then you doing at the batch file script this thing:
set %something%=ABC
After you done this you adding this to the batch script:
Echo %something% >> Name.exe
Don't forget to name the EXE file at the name of the program / game.
And now, if this message didn't help to you, maybe you need to make a EXE from batch file.
PART 2 - If you want to make an EXE file of batch file.
Open the start menu of Windows and search this:
IExpress
Don't let the computer search for you the full name, its working only if you wtiting the full name.
After you search IExpress, click on "Activate Command".
Click on Next, Don't change the first options.
Click on "Extract files only" and click on Next.
Name the EXE program and click Next.
Stay on "No prompt." and continue.
Now you can display a program License. if you want do a txt file and choose the display option.
Add batch files and click Next.
click on the option you want and click Next.
If you want a finish message, click on display message and write the message.
Here browse where the EXE will be and choose your options, click Next.
click Next.
Wow that's was super-long! Hope I helped you!

Resources