1
   

Batch Files?

 
 
craigr
 
Reply Wed 23 Feb, 2005 04:28 pm
I have created a .bat file to backup a directory on my c:\drive to a Network Server drive. - It has worked great for a couple of years.

My question is - Is there a way to do this in 'Windows' without having to call up the cmd window? I am having difficulty creating a NEW .bat file for files that are buried within 7 & 8 subdirectories on my c:\ drive. (A different program). It's the ~ thing after the first few letters of the folder / file names that makes it sooo difficult. Confused

Thanks in advance, craigr
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 1 • Views: 775 • Replies: 7
No top replies

 
silversturm
 
  1  
Reply Wed 23 Feb, 2005 04:52 pm
I have never had any luck creating a batch file and forcing the cmd window not to show through windows. It would be great if it were just a simple "Hide Command Window" option in the properties window of the BAT file.

The only way I know of doing this is via a programming language that can suppress this. But this requires that you have a least a little experience programming and the tools to do so (a simple program to do what you want is maybe 5 lines). In VB6 and prior you could use the Shell function, and in C# you could use the System.Diagnostics.Process class, as examples.

Wish I could help more.
0 Replies
 
craigr
 
  1  
Reply Thu 24 Feb, 2005 08:58 am
I apparently did not explain myself well enough Embarrassed

What I am lookng for is an 'automation' prg / fuction that REPLACES the batch process.

I am having trouble with the ~ that the cmd uses for folder / file names. I would like to be able to write the process using the full names - without the ~.

Thanks anyway,
craigr
0 Replies
 
silversturm
 
  1  
Reply Thu 24 Feb, 2005 11:00 am
What's your OS? I was under the impression that now-a-days the MICROS~3 thing was irrelevant because generally you just put quotes around things and it's all good. But you've probably thought of this.

C:\PROGRA~1\MICROS~2\MYFILE.EXE

"C:\Program Files\Microsoft Office\MyFile.exe"

Just a thought.
0 Replies
 
craigr
 
  1  
Reply Thu 24 Feb, 2005 11:15 am
"What's your OS?" - Win2000 Pro

"I was under the impression that now-a-days the MICROS~3 thing was irrelevant because generally you just put quotes around things and it's all good. But you've probably thought of this".

"C:\PROGRA~1\MICROS~2\MYFILE.EXE"

"C:\Program Files\Microsoft Office\MyFile.exe"

No I haven't thouht of that. - In fact, I'm not sure what you are talking about. Embarrassed

Please elaborate on the 'put quotes around things and it's all good.'

Thanks for your response, craigr
0 Replies
 
silversturm
 
  1  
Reply Thu 24 Feb, 2005 05:07 pm
I believe on post-Win98 machines (not sure if DOS on Win98 does this) that all path references can have spaces in them (and longer names).

Here's some examples to get you familiar:

Example 1:
* Create a shortcut to Microsoft Word (right click on executable, hold, drag to desktop, release, select Copy as Shortcut).
* Right click on shortcut, click on Properties, go to the middle tab, where the Target should read

C:\Program Files\Microsoft Office\Office11\winword.exe or
"C:\Program Files\Microsoft Office\Office11\winword.exe"
(or something like that)

If you double-click on the shortcut, Word will just boot up, but if you give it a file name after the executable, it will open that file when it boots up:

"C:\Program Files\Microsoft Office\Office11\winword.exe" C:\mydoc.doc

But if you want to specify a file name with spaces, you have to add double-quotes:

"C:\Program Files\Microsoft Office\Office11\winword.exe" "C:\my family document.doc"

If you don't put the double quotes around your filename, it will assume you are passing it three files, one called C:\my, another called family, and a third called document.doc.

And, the original DOS naming conventions are still supported.

C:\Progra~1\Micros~1\Office~1\winword.exe C:\myfami~1.doc

Example 2:
* Boot up a DOS prompt
* Type cd \
* Type cd C:\Program Files
You'll see it correctly changes to C:\Program Files. Although you don't need double-quotes, you can put them in too. Some programs are smart enough not to require them if the context is right.

So I don't know exactly what the context of your path references is but you should just be able to forget about the ~1 notation from now on, especially for a batch file which is basically just a bunch of DOS programs executing. In your code, or commands, just replace the ~ notation with the full paths, and put quotes around the whole path. Let me know if this works for you, if not maybe there's a specific issue of which I haven't thought yet...which is entirely possible Smile
0 Replies
 
craigr
 
  1  
Reply Fri 25 Feb, 2005 06:59 am
GREAT response - and Thank you. Smile

I understand completely now, (I think).
It sounds like I have been doing things the old/hard way, when it is no longer needed.

I will save your post for future reference.

Thanks again, craigr
0 Replies
 
silversturm
 
  1  
Reply Fri 25 Feb, 2005 11:46 am
You're very welcome
0 Replies
 
 

Related Topics

Clone of Micosoft Office - Question by Advocate
Do You Turn Off Your Computer at Night? - Discussion by Phoenix32890
The "Death" of the Computer Mouse - Discussion by Phoenix32890
Windows 10... - Discussion by Region Philbis
Surface Pro 3: What do you think? - Question by neologist
Windows 8 tips thread - Discussion by Wilso
GOOGLE CHROME - Question by Setanta
.Net and Firefox... - Discussion by gungasnake
Hacking a computer and remote access - Discussion by trying2learn
 
  1. Forums
  2. » Batch Files?
Copyright © 2025 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 12/27/2025 at 01:37:31