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?
- What exactly are DLL files, and how do they work?
- How to fix “VirtualBox Interface has active connections” error in Windows?
- How to fix “VirtualBox Interface has active connections” error in Windows?
- ‘pip’ is not recognized as an internal or external command
- The application was unable to start correctly (0xc000007b)
- Why is “MINGW64” appearing on my Git bash?
- How can I update npm itself?
- outputting ascii table in C++
- Using %PROGRAMFILES(x86)% on Windows OS 32bit
- how to get program files x86 env variable?
- Difference between masm32 and masm?
- Can’t start Eclipse – Java was started but returned exit code=13
- Can’t start Eclipse – Java was started but returned exit code=13
- How do I start PowerShell from Windows Explorer?
- Tensorflow import error: No module named ‘tensorflow’
- A fatal error occurred while creating a TLS client credential. The internal error state is 10013
- Unexplained crashes related to ntdll.dll
- How can I install pip on Windows?
- How to log in to phpMyAdmin with WAMP, what is the username and password?
- How to upgrade Git on Windows to the latest version
- PermissionError: [Errno 13] Permission denied
- Permanently add a directory to PYTHONPATH?
- What are good grep tools for Windows? [closed]
- How to run a PowerShell script
- bash: npm: command not found?
- How to add to the PYTHONPATH in Windows, so it finds my modules/packages?
- ‘git’ is not recognized as an internal or external command
- How do I install and use cURL on Windows?
- Failed to write core dump. minidumps are not enabled by default on client version of windows
- “Javac” doesn’t work correctly on Windows 10
- How to list files in windows using command prompt (cmd). I’ve tried using ‘ ls ‘ as in Linux but it shows an error?
- Can’t connect to MySQL server on ‘localhost’ (10061) after Installation
- ow can I find where Python is installed on Windows?
- “Couldn’t find a file descriptor referring to the console” on Ubuntu bash on Windows
- Ignoring directories in Git repositories on Windows
- ‘git’ is not recognized as an internal or external command
- C compiler for Windows?
- Setting Windows PowerShell environment variables
- Can’t connect to MySQL server on ‘localhost’ (10061) after Installation
- finding dll for “The specified module could not be found”
- Why is Windows 32-bit called Windows x86 and not Windows x32?
- How to install MinGW 64 on windows 10
- What does %~dp0 mean, and how does it work?
- ” is not recognized as an internal or external command, operable program or batch file
- How to run a PowerShell script
- How can I clear console
- How to go from fopen to fopen_s
- Copying a local file from Windows to a remote server using scp
- undefined reference to WinMain@16 (codeblocks)
- How can you find out which process is listening on a TCP or UDP port on Windows?
- How can I open a cmd window in a specific location?
- What does %~dp0 mean, and how does it work?
- anaconda – path environment variable in windows
- “X does not name a type” error in C++
- Python 3.2 Unable to import urllib2 (ImportError: No module named urllib2)
- ‘adb’ is not recognized as an internal or external command, operable program or batch file
- Windows 7 exception code: 0xc0000409
- How to install and use “make” in Windows?
- Filename too long in Git for Windows
- How to remove anaconda from windows completely?
- “X does not name a type” error in C++
- Difference between ‘strcpy’ and ‘strcpy_s’?
- what is a “dump file” in windows task manager?
- How can I find and run the keytool
- Python 3.2 Unable to import urllib2 (ImportError: No module named urllib2)
- How do I run Redis on Windows?
- make: g++: Command not found
- Need to navigate to a folder in command prompt
- Rainbow Matrix CMD
- ” is not recognized as an internal or external command, operable program or batch file
- Python virtualenv questions