Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Windows 8.1 and Dos commands


  • Please log in to reply
19 replies to this topic

#1 Redamo

Redamo

  • Members
  • 10 posts
  • OFFLINE
  •  
  • Local time:07:08 PM

Posted 09 March 2014 - 07:09 PM

Merged topics - Hamluis.

 

Hi, I've been revisiting some of the DOS commands for Powershell scripting and am having a hard time getting the sound to play consistently from the internal speaker; ie, the old beep or ding.

 

I can type ^G and press enter at the dos prompt and get the sound, but running from a batch file I seem to get the sound once, and then the batch file doesn't work.  I've tried @echo ^G and have used Alt-7 (on numpad) to get the large bullet.  Both play the sound once, but not a 2nd time from the batch file.

 

I don't want a program to open, just a sound after the batch file completes.

 

2nd, I was wondering if there is a Dos command that after a batch file completes, the command will activate the Start Screen?  I have some batch files that run from tiles on my start screen, but when finished, end up at the desktop.  I'd like them to end up back at the start screen.

 

Any help on these 2 issues will be greatly appreciated.

 

R


Edited by hamluis, 10 March 2014 - 10:26 AM.
Moved from Win 8 to DOS/PDA - Hamluis.


BC AdBot (Login to Remove)

 


#2 JohnC_21

JohnC_21

  • Members
  • 24,615 posts
  • ONLINE
  •  
  • Gender:Male
  • Local time:08:08 PM

Posted 10 March 2014 - 07:57 AM

Hello, and welcome to Bleeping Computer. PM a moderator and ask them to move this post to the Programming Forum. I think you will have a better chance of getting a response. Good Luck.

 

Mod Edit:  You can always use the Report button to bring topics like this to the attention of the BC Staff, no response needed - Hamluis.


Edited by hamluis, 10 March 2014 - 10:20 AM.


#3 Redamo

Redamo
  • Topic Starter

  • Members
  • 10 posts
  • OFFLINE
  •  
  • Local time:07:08 PM

Posted 10 March 2014 - 08:38 AM

Hi, I've been revisiting some of the DOS commands to run a few small Powershell scripts and am having a challenge getting a simple sound to play consistently from the internal speaker; beep or ding.

 

Windows 8.1, 64-bit system.

 

I can type ^G and press enter at the dos prompt and get the sound, but running from a batch file in notepad I seem to get the sound once, and then the file doesn't work again.  I've tried @echo ^G and have used Alt-7 (on numpad) to get the large bullet.  Both play the sound once, but not a 2nd time.

 

I don't want a sound program to open, just a sound after the batch file completes.  Although a wav file that plays without opening sndrec.exe or wmplayer is good too.  I've tried these with /embedding / play /close, but no luck.

 

2nd, I was wondering if there is a Dos command where, after a batch file completes, this command will activate the Start Screen?  I have some batch files that run from tiles on my start screen, but when finished, end up at the desktop.  I'd like them to return the start screen.

 

Any help on these 2 issues will be greatly appreciated.

 

R



#4 cryoganix

cryoganix

  • Members
  • 95 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Local time:01:08 AM

Posted 10 March 2014 - 09:31 AM

Hm...what would happen if you were to type:

echo [Alt-7] > beep.txt

in a command prompt, then make a batch file that calls:

type beep.txt

Would that make the beeping sound? Also, remember that the Alt-7 (and probably ^G) beep sounds (should*) only play if done through a text-only editor (such as Sublime Text or echoing to a file via cmd). If possible, could you also post a code snippet of the part (or all) of the file that you're trying to modify?  :thumbup2:



#5 Redamo

Redamo
  • Topic Starter

  • Members
  • 10 posts
  • OFFLINE
  •  
  • Local time:07:08 PM

Posted 10 March 2014 - 09:53 AM

starting cmd prompt as administrator I entered the instruction.  But I only have notepad so the sound didn't occur.  When I type directly beep.txt at the cmd prompt, notepad opened with [Alt-7] typed.

 

I could actually do without the beep sound if a command is available at the end of the batch that activates the Win8 Start Screen?  that would be cool.  Aware of a batch command for that?

 

Thanks Cryo



#6 Ant.Man

Ant.Man

  • Members
  • 129 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Just left of DC
  • Local time:08:08 PM

Posted 10 March 2014 - 09:55 AM

how to make a beep command in .bat file

 

copy con go.bat
@echo off
echo Ctrl+G
Ctrl+Z

go


Edited by Ant.Man, 10 March 2014 - 10:08 AM.

This is not my signature.


#7 Redamo

Redamo
  • Topic Starter

  • Members
  • 10 posts
  • OFFLINE
  •  
  • Local time:07:08 PM

Posted 10 March 2014 - 10:11 AM

I typed the command lines at the c prompt

then typed go.cmd

and got 'Ctrl+Z' is not recognized as an internal or external command...

speaker sound is on, confirmed



#8 cryoganix

cryoganix

  • Members
  • 95 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Local time:01:08 AM

Posted 10 March 2014 - 10:11 AM

Oh, sorry about that! By [Alt-7], I meant holding down Alt and pressing 7 on they numpad, not literally typing in "[Alt-7]".  :blush:
 
As for the Windows 8 start screen, you could always try making a temporary VBScript file that sends the CTRL and ESC keys simultaneously, then run the VBS file in the batch file, then delete the temporary VBS file when the keypresses are complete. :P



#9 Redamo

Redamo
  • Topic Starter

  • Members
  • 10 posts
  • OFFLINE
  •  
  • Local time:07:08 PM

Posted 10 March 2014 - 10:21 AM

Same thing, except now the large bullet appears in notepad when I type beep.txt.

 

I like the idea on the vbs script that sends ctrl-esc keys simultaneously, then call it from the batch file.  Or can the windows key be called?  Unfortunately I'm not a programmer, other than Excel VBA, which most would not consider programming at all.  To run the VBScript wouldn't I need Visual Basic installed?  Any chance you have this send statement?



#10 cryoganix

cryoganix

  • Members
  • 95 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Local time:01:08 AM

Posted 10 March 2014 - 11:33 AM

Same thing, except now the large bullet appears in notepad when I type beep.txt.


Huh, weird. It works whenever I do it in Windows 7.  :huh: 
 

To run the VBScript wouldn't I need Visual Basic installed?  Any chance you have this send statement?


You wouldn't need Visual Basic, since this is Visual Basic Script, or VBS/VBScript. Also, this is the code that will send the CTRL+ESC key combination, which opens the start menu. I'm not personally aware of any specific Windows key. Put this into Notepad and save it as a .VBS file. (you can run it afterwards to make sure it works)

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "^{ESCAPE}"


#11 Redamo

Redamo
  • Topic Starter

  • Members
  • 10 posts
  • OFFLINE
  •  
  • Local time:07:08 PM

Posted 10 March 2014 - 01:42 PM

Wow, very cool.  Even I was able to make this work.  You've solved my issues today and I'm very thankful to you for that.  As far as the sound issue, I'm sure it's a user issue as I'm not confident of what i'm doing outside of Excel.

 

In windows 8 the windows key does the same thing as Ctrl-Esc.

 

Best of success in your studies!



#12 cryoganix

cryoganix

  • Members
  • 95 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Local time:01:08 AM

Posted 10 March 2014 - 01:54 PM

Thanks!  :lol:

 

Also, if you still need help with getting the beeping to work, open up Command Prompt and copy/paste this into it:

echo • > test.txt && type test.txt

If your computer makes a beeping sound, then, while still in Command Prompt, you can type in "type test.txt" as many times as you wish and it will beep every time.  :)



#13 cryoganix

cryoganix

  • Members
  • 95 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Local time:01:08 AM

Posted 10 March 2014 - 02:19 PM

Update: I just got my coworker to try it on his Surface Pro running Windows 8.1, and he said it works flawlessly. I'd guess it has to do with the way that DOS handles certain ASCII characters.

 

If you type the • symbol in Notepad and then save it as a .TXT file, then it will literally save the ASCII character 0x98.

 

However, if you were to echo out the • symbol in a Command Prompt and then store the output in a .TXT file (the part of the command above before the &&), then the .TXT file will now contain the data 0x07 0x20 0x0D 0x0A, which, in order, is the bell symbol (0x07) (also known as a beep), a space (0x20), a carriage return (0x0D), and a line feed (0x0A). This happens because the Command Prompt interprets the • symbol as the bell symbol in its own environment (DOS) and then stores that interpreted output into a file.

 

If you were to open either file in Notepad, they'd look perfectly similar.

 

The first method, when used with the type command, will usually produce a ò symbol. However, when used with the second method, the output will be a beep followed by the end of the command line, since the type command is now interpreting DOS instructions followed by the EOL characters.

 

THE MORE YOU KNOW~  :thumbup2:


Edited by cryoganix, 10 March 2014 - 02:23 PM.


#14 Redamo

Redamo
  • Topic Starter

  • Members
  • 10 posts
  • OFFLINE
  •  
  • Local time:07:08 PM

Posted 10 March 2014 - 02:56 PM

Thanks for explanation.  I get the picture and was able to replicate your instructions.  But here is what I am looking for:  a command line in my notepad batch file that will produce a sound.  What I gather from your recent comment is I can manually produce the beep, but I need the batch file to produce it.  I tried to incorporate your instructions into my batch file but was unsuccessful.

 

I did add two lines in my notepad batch file that gets the vbs you sent working - it changes the path to location of vbs file, then executes the file's vbs commands.  Now when the batch file completes, the start screen returns - beautiful !

 

If I could get the batch file to beep or play a sound without opening a sound program, an alert if you will, that would be icing on the windows 8 tile; ie, the batch file, or cake...

 

thanks so much.



#15 cryoganix

cryoganix

  • Members
  • 95 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Local time:01:08 AM

Posted 10 March 2014 - 03:17 PM

Hm...would it be possible to post the contents of the batch file in your reply? If it's too long to post, could you zip it and upload it as an attachment in your reply? I might be able to troubleshoot the issue further if I knew the code that wasn't producing the desired effects.  :busy:






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users