I have a Windows .bat file which I would like to accept user input and then use the results of that input as part of the call to additional commands.
For example, I’d like to accept a process ID from the user, and then run jstack against that ID, putting the results of the jstack call into a file. However, when I try this, it doesn’t work.
Here’s my sample bat file contents:
@echo off set /p id=Enter ID: echo %id% jstack > jstack.txt
and here’s what shows up in jstack.txt:
Enter ID: Terminate batch job (Y/N)?
Related Posts:
- What does “@” mean in Windows batch scripts
- Create an empty file on the commandline in windows (like the linux touch command)
- How to solve “The directory is not empty” error when running rmdir command in a batch script?
- How do I create a Batch file to change an exe installer to Win XP SP3 compatibility mode and launch installer
- Difference between xcopy and robocopy
- Bat file to run a .exe at the command prompt
- Batch script loop
- How to run PowerShell in CMD
- xcopy returns error “Invalid number of parameters” when exclude parameter is set
- While loop in batch
- XCOPY: Overwrite all without prompt in BATCH
- Curl not recognized as an internal or external command, operable program or batch file
- Redirecting Output from within Batch file
- How to send a simple email from a Windows batch file?
- How can I run a program from a batch file without leaving the console open after the program starts?
- What does /p mean in set /p?
- False ‘Sharing Violation’ Xcopy error message
- batch file from scheduled task returns code 2147942401
- How does the echo command works in batch programming
- CALL command vs. START with /WAIT option
- BAT file to map to network drive without running as admin
- Need auto-restart script in batch for minecraft server
- How to use random in BATCH script?
- Windows batch – concatenate multiple text files into one
- How to set commands output as a variable in a batch file
- Batch command for ImageMagick to convert all files in a directory and sub-directories on windows
- Best practice for exiting batch file?
- how to empty recyclebin through command prompt?
- How to sleep in a batch file?
- How to fix “VirtualBox Interface has active connections” error in Windows?
- ‘pip’ is not recognized as an internal or external command
- outputting ascii table in C++
- Difference between masm32 and masm?
- Tensorflow import error: No module named ‘tensorflow’
- A fatal error occurred while creating a TLS client credential. The internal error state is 10013
- How can I install pip on Windows?
- bash: npm: command not found?
- Setting Windows PowerShell environment variables
- finding dll for “The specified module could not be found”
- Windows 7 exception code: 0xc0000409
- ‘npm’ is not recognized as internal or external command, operable program or batch file
- How to “comment-out” (add comment) in a batch/cmd?
- error: Unable to find vcvarsall.bat
- What languages are Windows, Mac OS X and Linux written in?
- stop all instances of node.js server
- Python command not working in command prompt
- LNK1168: cannot open debug\file.exe for writing
- Command line for looking at specific port
- How to uninstall a Windows Service when there is no executable for it left on the system?
- Windows Activator .bat Text
- “rm -rf” equivalent for Windows?
- VC++ fatal error LNK1168: cannot open filename.exe for writing
- Xampp MySQL not starting – “Attempting to start MySQL service…”
- Python 3.2 Unable to import urllib2 (ImportError: No module named urllib2)
- Create PDF file using PHP
- How to stop Python closing immediately when executed in Microsoft Windows
- How Should I Set Default Python Version In Windows?
- Anaconda Installed but Cannot Launch Navigator
- scp from Linux to Windows
- Defining and using a variable in batch file
- Sleep/Wait command in Batch
- “Javac” doesn’t work correctly on Windows 10
- How to open an elevated cmd using command line for Windows?
- SVN admin management GUI tool
- Windows 7 – ‘make’ is not recognized as an internal or external command, operable program or batch file
- How to change current working directory using a batch file
- How to sleep for five seconds in a batch file/cmd
- What exactly is the scope of Access Violation ‘0xc0000005’?
- Open File in Another Directory (Python)
- How can I download a file with batch file without using any external tools?
- What is a Windows Handle?
- Error: Could not find or load main class net.minecraft.launchwrapper.Launch when launching Minecraft 1.12.2 with Forge
- npm install with error: `gyp` failed with exit code: 1
- The requested operation cannot be performed on a file with a user-mapped section open
- Batch – If, ElseIf, Else
- HyperV is not available on Home editions
- Unable to start MySQL server
- Dependency Walker: missing dlls
- How do I execute a *.dll file
- How to enable Bash in Windows 10 developer preview?
- Posting with slug “favicon” gets redirected
- WP Cli will not execute on Windows
- Offline WordPress Application
- Accessing private posts through REST API, same code that works in remote doesn’t in local
- WordPress on XAMPP over my home network [closed]
- WordPress database setup Windows 2016 IIS
- Does WordPress Support Using Named Pipes on the Windows Operating System?
- How do I tell Git for Windows where to find my private RSA key?
- What’s the command-line utility in Windows to do a reverse DNS look-up?
- hosts file ignored, how to troubleshoot?
- Command line to list users in a Windows Active Directory group?
- What is Active Directory Domain Services and how does it work?
- Is my password compromised because I forgot to hit Enter after ssh username?
- In Windows, using the command line, how do you check if a remote port is open?
- What’s the reverse DNS command line utility?
- Windows server last reboot time
- Why hasn’t rsync caught on in the Windows world? [closed]
- Boot and Install Windows from a USB thumb drive
- How to fix PuTTY showing garbled characters? [closed]
- How to configure a Windows machine to allow file sharing with a DNS alias