Link to home
Start Free TrialLog in
Avatar of Mezillinu
MezillinuFlag for Malta

asked on

How do I use spaces in batch files? Is there a way to make strings in batch files as one? Like in .NET example "Look_at_me"

As you can see in the batch file below, the password has a space between it, are there any ways of making the CMD reading this as one string? Like in .NET example we use "test !"

how can i do this in batch files?

same goes for the folder D:\sqlserver data

this seems to be giving errors to the CMD - problems with spaces. How can I make the CMD read this as one?

thanks for the help guys, appreciated!
NET USE X:\\0.0.0.0\C$ Password !01 /USER:Administrator /PERSISTENT:NO
 
MOVE D:\sqlserver data\Backup\one\*.* X:\BACKUP\DB
 
MOVE D:\sqlserver data\Backup\two\*.* X:\BACKUP\DB
 
MOVE D:\sqlserver data\Backup\three\*.* X:\BACKUP\DB
 
pause

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Farhan Kazi
Farhan Kazi
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Mezillinu,

All you need to do is put the line with spaces have quotes either sides for example.

MOVE "D:\sqlserver data\Backup\one\*.*"  X:\BACKUP\DB

Hope this helps.

Gav