This question already has answers here:
Adding a directory to the PATH environment variable in Windows
(21 answers)
Adding environment variable from command prompt / batch file
(2 answers)
How to set PATH environment variable in batch file only once on Windows?
(2 answers)
Why are other folder paths also added to system PATH with SetX and not only the specified folder path?
(1 answer)
Adding the current directory to Windows path permanently
(2 answers)
Closed 4 years ago.
Is there a way to append a Registry key with a batch file? To be clear, I don't want to replace the key, I want to add to it.
Example:
Key Location: HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
Change: C:\Windows;C:\Java
To: C:\Windows;C:\Java;C:\Program Files (x86)\CFLAT
It's a REG_EXPAND_SZ, so [~] won't work, unless I'm doing it wrong.
https://msdn.microsoft.com/en-us/library/aa371168(VS.85).aspx
Save this to something.reg. Execute this with double click and you will set changes. This is maybe overwriting but I think this is better idea.
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v C:\Windows;C:\Java;C:\Program Files (x86)\CFLAT /t REG_SZ /f
Related
This question already has answers here:
How can you get the clipboard contents with a Windows command?
(14 answers)
Access clipboard in Windows batch file
(11 answers)
Closed 2 years ago.
I am working on a batch script that runs .exe files in a given folder. It should do something like this:
SET /P _inputname= Please enter app folder path:
cd %_inputname%
dir /s /b *.exe | clip
"paste-from-clipboard"
However, for my last line, I haven't found a way to paste from clipboard without using a mouse/keyboard shortcut. I would greatly appreciate it if anyone has a solution.
To copy & paste within windows command line you can use:
https://github.com/kpym/windows-paste
It's the successor of the once famous paste.exe.
See also How can you get the clipboard contents with a Windows command?
This question already has answers here:
Append a directory to PATH Environment Variable in Windows
(3 answers)
Why are other folder paths also added to system PATH with SetX and not only the specified folder path?
(1 answer)
How to search and replace a string in environment variable PATH?
(1 answer)
Adding the current directory to Windows path permanently
(2 answers)
What is the reason for "X is not recognized as an internal or external command, operable program or batch file"?
(4 answers)
Closed 3 years ago.
My PATH has few entries like %SystemRoot%, %USERPROFILE%/... etc which are pointing to another env variable. But when I update the PATH with command line, it replaces those env entries with actual value like e.g. below
Earlier Entry : %SystemRoot%;%USERPROFILE%\AppData
SETX MY_ENV "C:\MyData"
SETX PATH %MY_ENV%;%PATH%
Path Value : C:\MyData;C:\Windows;C:\USers\UserName\AppData
But, I am looking for a solution which can be run directly as cmd line por through Batch programming that will set my Path as below
%MY_ENV%;%%SystemRoot%;%USERPROFILE%\AppData
This is not the Path variable meant for logged in user but is the system path variable.
This question already has answers here:
Batch command to copy files from source to destination [duplicate]
(1 answer)
Copy Contents From Folder Using Wildcard On The Directory
(1 answer)
xcopy wildcard source folder name to destination
(2 answers)
Using a batch file to copy files with a wildcard in the directory path?
(2 answers)
Closed 3 years ago.
I'm trying to write a batch-file to uninstall GoToMeeting.
Currently I use the following to uninstall the current version:
echo UnInstalling GoToMeeting........
"C:\Program Files (x86)\GoToMeeting\13190\G2MUninstall.exe" /uninstall -silent
The problem is, with each install of a new version, the install directory changes. For example, the version is 13190 but the previous time it was 13022 and 12771 before that. So I practically have to add a line for each version and that is really annoying.
Is there a way using a batch-file to make the directory a wild card during the uninstall?
sorry, no wildcard allowed unless in the very last element of a path or filename.
Instead use a for /d loop to list all subdirectories of a certain directory:
for /d %%D in ("C:\Program Files (x86)\GoToMeeting\*") do (
echo the file you look for is "%%D\G2MUninstall.exe"
)
Bonus: if several versions are installed, this finds all of them
This question already has answers here:
Assign command output to variable in batch file [duplicate]
(5 answers)
Closed 6 years ago.
For my batch file I need to do a few different things...I have completed steps 1-3
1) Perform a dir search and save the result of that search in a variable
2) Set the destination path as a variable
3) Copy the source file to the destination path
My code so far :
#echo off
cls
cd /d D:\Downloads\Videos
set "flshvid=&dir *flash*.mkv /s /b"
set "flshdir=O:\Aayush\Videos\TV Shows\The Flash\Season 3"
xcopy %flshvid% %flshdir%
Why doesn't this code work?
Any help is appreciated. Thanks in advance!
Environment variables may not start with a numeric because %n where n is 0..9 refers to the serial parameter number provided to the routine.
replace 1 and 2 with variable names that do not start with a numeric
This question already has answers here:
How do I get current date/time on the Windows command line in a suitable format for usage in a file/folder name?
(30 answers)
Closed 7 years ago.
I am fairly new with creating batch files.
I have made a batch file with the following content:
"C:\Program Files (x86)\Runtime Software\DriveImage XML\dixml.exe" /bC /c /l /t"B:\DRIVE IMAGES\Windows10_maintenance_backup
This allows me to run DriveImage XML and take a backup simply by running the bat file.
I would like the bat file to automatically make a folder with today's date so that:
B:\DRIVE IMAGES\Windows10_maintenance_backup
Becomes:
B:\DRIVE IMAGES\2016.01.20\Windows10_maintenance_backup
How can I achieve this by editing the .bat file?
I have had a look at foxidrives solution here but I do not know how to implement the solution.
echo md B:\DRIVE IMAGES\%date:~-4%.%date:~7,2%.%date:~4,2%\windows10\etc
See set /? for help on substring extraction.
This assumes date is in following format
Thu 21/01/2016