Jump to content
Sign in to follow this  
alfa

[Solved] Help with running command with spaces

Recommended Posts

alfa

Hello,

I am trying to run this

reg export "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\profiles" c:\profiles.reg

as

RunWait(@ComSpec & " /c " & "reg export HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\profiles' c:\profiles.reg","")

The first code is working in the command line. But because of the spaces i have to take the whole command between "". But in autoit it doesnt seem to recognice that way.

Since the thing i want to export is not a single key i cant use regread also.

Thanks in advance.

Edited by alfa

Share this post


Link to post
Share on other sites
lordofthestrings

use double/single quotes like this: (you forgot a single quote btw)

RunWait(@ComSpec & " /c reg export 'HKCUSoftwareMicrosoftWindows NTCurrentVersionWindows Messaging Subsystemprofiles' c:profiles.reg","")


Share this post


Link to post
Share on other sites
alfa

I have tried that and tried it again now. but it doesnt work. I see the cmd screen but it doesnt generate the the file.

Thanks a lot for the answer though.

Share this post


Link to post
Share on other sites
lordofthestrings

RunWait(@ComSpec & ' /c reg export "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionWindows Messaging SubsystemProfiles" ' & @TempDir & 'profiles.reg',@TempDir, @SW_HIDE)


Share this post


Link to post
Share on other sites
lordofthestrings

made the key/populated it, then read it like this. there was an error in the code indeed sorry :)


Share this post


Link to post
Share on other sites
alfa

yay :) thanks a lot for the help... it worked

Share this post


Link to post
Share on other sites
lordofthestrings

easiest way to solve this type of problem is to echo it in the cmd:

RunWait(@ComSpec & ' /k echo reg export "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionWindows Messaging SubsystemProfiles" ' & @TempDir & 'profiles.reg',@TempDir, @SW_show)
Edited by lordofthestrings

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×