Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Getting input data after execution of batch file.

08 Nov 2014   #1

Windows 8 ultimate 32 bit
Getting input data after execution of batch file.

My batch file code is like this:

@echo off
C:\Windows\System32\netsh.exe wlan set hostednetwor mode=allow ssid=User_Name key=password eyUsage=persistent

In this code the "User_name" and "password" fields I want the input from the user after running the batch file. How do I make it ??? Please help. And also suggest me modifications in this code if any.

My System SpecsSystem Spec
08 Nov 2014   #2

Windows 7 Ultimate 64-bit, Windows 8.1 64-bit, Mac OS X 10.10, Linux Mint 17, Windows 10 Pro TP

No suggestion for the input part but generally a batch file is completed when it finishes the last line and closes. If I don't want the Command Prompt window to close until I have read it I put Pause as the last element, won't go beyond that until I hit Enter to let it complete.
My System SpecsSystem Spec
08 Nov 2014   #3

Windows 10 Pro X64

Request the input before running netsh:

@echo off
set /p UserName= Enter User name: 
set /p Password= Enter Password: 
echo Username is %UserName% and Password is %Password%

C:\Windows\System32\netsh.exe wlan set hostednetwor mode=allow ssid=%UserName% key=%Password% eyUsage=persistent
For readability, make sure there is a space after name: and Password:.
My System SpecsSystem Spec

08 Nov 2014   #4

Windows 7 Ultimate x64

Typically console programs request additional info on the command line and use those or report an error if they were not provided. Try something like this:

@echo off
if "%1"=="" goto ShowUsage
if "%2"=="" goto ShowUsage
C:\Windows\System32\netsh.exe wlan set hostednetwor mode=allow ssid=%1 key=%1 keyUsage=persistent
goto End

:goto ShowUsage
echo You must specify username and password.
Example: SetWlan MyUser MyPassword

Here assuming this file is named SetWlan.
Then invoke it like any other command line tool:

SetWlan MyUser MyPassword
Providing the wrong parameters will print the correct usage instructions.
My System SpecsSystem Spec
09 Nov 2014   #5

Windows 8 ultimate 32 bit
Thanks to everyone

Thanks for your valuable help. I got the solution which I want with your help. Thanks Once Again.
My System SpecsSystem Spec

 Getting input data after execution of batch file.

Thread Tools

Similar help and support threads
Thread Forum
Batch File execution problem
I have created a batch program as listed below. It is supposed to read all MP3 files from given folderMP3_CDs_12GB recursively and write to three folders B0 (first 999 files), B1 (next 999 files) and B2 (balance of about 2,800 files). It should also write three text files with the File serial...
General Discussion
Please help me with Batch, need manual input required see description
Hi there, I am trying to create a batch file which will use the command nbtstat-a and then request the IP of the user within the same line (e.g. nbtstat-a *please enter the target IP to lookup*) to look up the machine name of a computer on the network, the only problem is that i dont know how to...
General Discussion
Batch File Execution error
Please I need help! I have been on this stuff for over hours now..and no headway out. I want to write a batch script that can run tshark as shown below...
Performance & Maintenance
Notice from Data Execution Prevention
I'm running IE 9.0.8112.16421 and today I saw something I've never seen before. The notice read:IE has closed this webpage to help protect your computer. A malfunctioning or malicious add-on has IE to close this webpage. What you can do is: Go to your homepage; Try to return to the page you were...
Browsers & Mail
Batch File that grabs file names from folder to insert into batch file
Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can... :confused: First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg. Here's the code that I'm using: ffmpeg -i...
General Discussion
Data Execution Prevention (DEP)
I may have finally resolved a problem I've had with a program but changing DEP to protect only essential programs and not all programs. I tried it with all programs and inserted the wayward program as an exception but it didn't help. Once I changed it to essentials only, the program is finally...
System Security

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 08:12.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App