Solved Can a batch file pause to enter a password?

zarfs

New member
Local time
5:21 AM
Messages
22
Location
Southern California USA
I use Windows 7 Pro.

I have made a batch file to quickly back up certain files.

If I need to encrypt a backed-up file, I use WinZip to compress and encrypt it.

To encrypt, WinZip requires that you manually specify a password. This password must be entered repeatedly throughout the batch file. I'd like the batch file to pause the first time, wait for me to enter the password, then proceed, automatically entering that password whenever it is requested again.

Can this be done?

PS: I used to specify the password in the batch file itself, but that's not very secure. Anyone viewing the batch file could discern the password.
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell Inspiron 660
OS
Windows 7, 64-bit
CPU
Intel Core i3-3240 CPU @ 3.40GHz, 340
Memory
4 GB
Graphics Card(s)
In motherboard
Sound Card
In motherboard
Monitor(s) Displays
NEC MultiSync FE992 CRT
Screen Resolution
1280 x 1024
Hard Drives
Main drive: Manufacturer not specified. Model ST500DM002-1BD142 SATA 500 GB
Supplemental drive: Maxtor 6L300S0 SATA 300 GB
Cooling
1 CPU fan, 1 chassis fan.
Keyboard
Standard
Mouse
Dell optical USB
Internet Speed
11 Mb/sec
Antivirus
Norton Internet Security 20.4.0.40
Browser
Firefox
Yes

set /p variable= [string]

set /p secretword= Enter the secret word and win 100 dollars

Note there is a space before the prompt string, but no space after the variable
Then you can use the variable %secretword% throughout your bat file.
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP Pavilion dv6-6c10us
OS
x64 (6.3.9600) Win8.1 Pro & soon dual boot x64 (6.1.7601) Win7_SP1 HomePrem
CPU
AMD A6-3420M APU with Radeon(tm) HD Graphics
Motherboard
Hewlett-Packard 1805
Memory
6.00 GB
Graphics Card(s)
AMD Radeon(TM) HD 6520G
Sound Card
(1) AMD High Definition Audio Device (2) IDT High Definiti
Monitor(s) Displays
HP W2072a 20" LCD (1600 x 900) @ 60 Hz
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
ST640LM0 00 HM641JI SATA Disk Device
Keyboard
Logitech k520 wireless KB
Mouse
Logitech m320 wireless mouse (bundled with KB)
Internet Speed
15/5 | 54 MB Wireless 'n'
Antivirus
Realtime: Defender or Avast | On-demand: Malwarebytes, ESET
Browser
IE 11 on Win8, IE 10 on win 7
Other Info
Media: [Gimp, Audacity, VLC] || Comm: [WEmail 2012, Skype] || Productivity: [OpenOffice,| Textpad] || Utils: [Sysinternals, cCleaner, Speccy, Defraggler]
It works fine

Many, many thanks.
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell Inspiron 660
OS
Windows 7, 64-bit
CPU
Intel Core i3-3240 CPU @ 3.40GHz, 340
Memory
4 GB
Graphics Card(s)
In motherboard
Sound Card
In motherboard
Monitor(s) Displays
NEC MultiSync FE992 CRT
Screen Resolution
1280 x 1024
Hard Drives
Main drive: Manufacturer not specified. Model ST500DM002-1BD142 SATA 500 GB
Supplemental drive: Maxtor 6L300S0 SATA 300 GB
Cooling
1 CPU fan, 1 chassis fan.
Keyboard
Standard
Mouse
Dell optical USB
Internet Speed
11 Mb/sec
Antivirus
Norton Internet Security 20.4.0.40
Browser
Firefox
Glad to have helped and thank you for marking your thread solved.
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP Pavilion dv6-6c10us
OS
x64 (6.3.9600) Win8.1 Pro & soon dual boot x64 (6.1.7601) Win7_SP1 HomePrem
CPU
AMD A6-3420M APU with Radeon(tm) HD Graphics
Motherboard
Hewlett-Packard 1805
Memory
6.00 GB
Graphics Card(s)
AMD Radeon(TM) HD 6520G
Sound Card
(1) AMD High Definition Audio Device (2) IDT High Definiti
Monitor(s) Displays
HP W2072a 20" LCD (1600 x 900) @ 60 Hz
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
ST640LM0 00 HM641JI SATA Disk Device
Keyboard
Logitech k520 wireless KB
Mouse
Logitech m320 wireless mouse (bundled with KB)
Internet Speed
15/5 | 54 MB Wireless 'n'
Antivirus
Realtime: Defender or Avast | On-demand: Malwarebytes, ESET
Browser
IE 11 on Win8, IE 10 on win 7
Other Info
Media: [Gimp, Audacity, VLC] || Comm: [WEmail 2012, Skype] || Productivity: [OpenOffice,| Textpad] || Utils: [Sysinternals, cCleaner, Speccy, Defraggler]
Back
Top